@@ -812,7 +812,7 @@ pub fn extract_project(
812812 "no matching language plugin found for {}, overwriting" ,
813813 target_location. display( )
814814 ) ;
815- extract_project_overwrite ( compressed_project, target_location) ?;
815+ extract_project_overwrite ( compressed_project, target_location, compression ) ?;
816816 }
817817 Ok ( ( ) )
818818}
@@ -907,7 +907,7 @@ pub fn extract_student_files(
907907 "no matching language plugin found for {}, overwriting" ,
908908 target_location. display( )
909909 ) ;
910- extract_project_overwrite ( compressed_project, target_location) ?;
910+ extract_project_overwrite ( compressed_project, target_location, Compression :: Zip ) ?;
911911 }
912912 Ok ( ( ) )
913913}
@@ -991,8 +991,24 @@ fn finish_stage(message: impl Into<String>) {
991991fn extract_project_overwrite (
992992 compressed_project : impl std:: io:: Read + std:: io:: Seek ,
993993 target_location : & Path ,
994+ compression : Compression ,
994995) -> Result < ( ) , LangsError > {
995- compression:: unzip ( compressed_project, target_location) ?;
996+ match compression {
997+ Compression :: Tar => {
998+ let mut archive = tar:: Archive :: new ( compressed_project) ;
999+ archive
1000+ . unpack ( target_location)
1001+ . map_err ( |e| LangsError :: TarExtract ( target_location. to_path_buf ( ) , e) ) ?;
1002+ }
1003+ Compression :: TarZstd => {
1004+ let decoder = zstd:: Decoder :: new ( compressed_project) . map_err ( LangsError :: ZstdDecode ) ?;
1005+ let mut archive = tar:: Archive :: new ( decoder) ;
1006+ archive
1007+ . unpack ( target_location)
1008+ . map_err ( |e| LangsError :: TarExtract ( target_location. to_path_buf ( ) , e) ) ?;
1009+ }
1010+ Compression :: Zip => compression:: unzip ( compressed_project, target_location) ?,
1011+ }
9961012 Ok ( ( ) )
9971013}
9981014
0 commit comments