@@ -812,7 +812,7 @@ pub fn extract_project(
812
812
"no matching language plugin found for {}, overwriting" ,
813
813
target_location. display( )
814
814
) ;
815
- extract_project_overwrite ( compressed_project, target_location) ?;
815
+ extract_project_overwrite ( compressed_project, target_location, compression ) ?;
816
816
}
817
817
Ok ( ( ) )
818
818
}
@@ -907,7 +907,7 @@ pub fn extract_student_files(
907
907
"no matching language plugin found for {}, overwriting" ,
908
908
target_location. display( )
909
909
) ;
910
- extract_project_overwrite ( compressed_project, target_location) ?;
910
+ extract_project_overwrite ( compressed_project, target_location, Compression :: Zip ) ?;
911
911
}
912
912
Ok ( ( ) )
913
913
}
@@ -991,8 +991,24 @@ fn finish_stage(message: impl Into<String>) {
991
991
fn extract_project_overwrite (
992
992
compressed_project : impl std:: io:: Read + std:: io:: Seek ,
993
993
target_location : & Path ,
994
+ compression : Compression ,
994
995
) -> 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
+ }
996
1012
Ok ( ( ) )
997
1013
}
998
1014
0 commit comments