File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ pub enum TmcError {
2626 TarFinish ( #[ source] std:: io:: Error ) ,
2727 #[ error( "Failed to read line" ) ]
2828 ReadLine ( #[ source] std:: io:: Error ) ,
29+ #[ error( "Failed to parse file {0}" ) ]
30+ SubmissionParse ( PathBuf , #[ source] Box < Self > ) ,
2931 #[ error( "Failed to canonicalize path {0}" ) ]
3032 Canonicalize ( PathBuf , #[ source] std:: io:: Error ) ,
3133 #[ error( "Error occurred in a child process" ) ]
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ fn copy_file(
112112 let extension = file. extension ( ) . and_then ( |e| e. to_str ( ) ) ;
113113 let is_binary = extension
114114 . map ( |e| NON_TEXT_TYPES . is_match ( e) )
115- . unwrap_or_default ( ) ;
115+ . unwrap_or ( true ) ; // paths with no extension are interpreted to be binary files
116116 if is_binary {
117117 // copy binary files
118118 debug ! ( "copying binary file from {:?} to {:?}" , file, dest_path) ;
@@ -122,7 +122,11 @@ fn copy_file(
122122 let source_file = file_util:: open_file ( file) ?;
123123
124124 let parser = MetaSyntaxParser :: new ( source_file, extension. unwrap_or_default ( ) ) ;
125- let parsed: Vec < MetaString > = parser. collect :: < Result < Vec < _ > , _ > > ( ) ?;
125+ let parse_result: Result < Vec < _ > , _ > = parser. collect ( ) ;
126+ let parsed = match parse_result {
127+ Ok ( parsed) => parsed,
128+ Err ( err) => return Err ( TmcError :: SubmissionParse ( file. to_path_buf ( ) , Box :: new ( err) ) ) ,
129+ } ;
126130
127131 // files that don't pass the filter are skipped
128132 if !file_filter ( & parsed) {
You can’t perform that action at this time.
0 commit comments