File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -35,12 +35,17 @@ pub fn zip_student_files<P: StudentFilePolicy>(
3535 . unwrap_or_else ( || entry. path ( ) ) ;
3636 if entry. path ( ) . is_dir ( ) {
3737 log:: trace!( "adding directory {}" , path. display( ) ) ;
38- writer
39- . add_directory ( path_to_zip_compatible_string ( path) , FileOptions :: default ( ) ) ?;
38+ writer. add_directory (
39+ path_to_zip_compatible_string ( path) ,
40+ FileOptions :: default ( ) . unix_permissions ( 0o744 ) ,
41+ ) ?;
4042 } else {
4143 let bytes = file_util:: read_file ( entry. path ( ) ) ?;
4244 log:: trace!( "writing file {}" , path. display( ) ) ;
43- writer. start_file ( path_to_zip_compatible_string ( path) , FileOptions :: default ( ) ) ?;
45+ writer. start_file (
46+ path_to_zip_compatible_string ( path) ,
47+ FileOptions :: default ( ) . unix_permissions ( 0o744 ) ,
48+ ) ?;
4449 writer
4550 . write_all ( & bytes)
4651 . map_err ( |e| TmcError :: ZipWrite ( path. to_path_buf ( ) , e) ) ?;
Original file line number Diff line number Diff line change @@ -399,15 +399,15 @@ fn execute_zip(
399399 if entry. path ( ) . is_file ( ) {
400400 writer. start_file (
401401 relative_path. to_string_lossy ( ) ,
402- zip:: write:: FileOptions :: default ( ) ,
402+ zip:: write:: FileOptions :: default ( ) . unix_permissions ( 0o744 ) ,
403403 ) ?;
404404 let bytes = file_util:: read_file ( entry. path ( ) ) ?;
405405 writer. write_all ( & bytes) . map_err ( LangsError :: ZipWrite ) ?;
406406 } else {
407407 // java-langs expects directories to have their own entries
408408 writer. start_file (
409409 relative_path. join ( "" ) . to_string_lossy ( ) , // java-langs expects directory entries to have a trailing slash
410- zip:: write:: FileOptions :: default ( ) ,
410+ zip:: write:: FileOptions :: default ( ) . unix_permissions ( 0o744 ) ,
411411 ) ?;
412412 }
413413 }
Original file line number Diff line number Diff line change @@ -294,9 +294,15 @@ pub fn prepare_submission(
294294 stripped. display( )
295295 ) ;
296296 if entry_path. is_dir ( ) {
297- archive. add_directory ( stripped. to_string_lossy ( ) , FileOptions :: default ( ) ) ?;
297+ archive. add_directory (
298+ stripped. to_string_lossy ( ) ,
299+ FileOptions :: default ( ) . unix_permissions ( 0o744 ) ,
300+ ) ?;
298301 } else {
299- archive. start_file ( stripped. to_string_lossy ( ) , FileOptions :: default ( ) ) ?;
302+ archive. start_file (
303+ stripped. to_string_lossy ( ) ,
304+ FileOptions :: default ( ) . unix_permissions ( 0o744 ) ,
305+ ) ?;
300306 let mut file = file_util:: open_file ( entry_path) ?;
301307 std:: io:: copy ( & mut file, & mut archive)
302308 . map_err ( |e| LangsError :: TarAppend ( entry_path. to_path_buf ( ) , e) ) ?;
You can’t perform that action at this time.
0 commit comments