[flutter_tools] remove unused zip verification (#64970)

This is no longer used, in favor of just attempting to unzip and handling the exception.
This commit is contained in:
Jonah Williams
2020-08-31 13:26:38 -07:00
committed by GitHub
parent 09a9671ed3
commit 15d18b9e42
3 changed files with 0 additions and 101 deletions

View File

@@ -93,14 +93,8 @@ abstract class OperatingSystemUtils {
void unzip(File file, Directory targetDirectory);
/// Returns true if the ZIP is not corrupt.
bool verifyZip(File file);
void unpack(File gzippedTarFile, Directory targetDirectory);
/// Returns true if the gzip is not corrupt (does not check tar).
bool verifyGzip(File gzippedFile);
/// Compresses a stream using gzip level 1 (faster but larger).
Stream<List<int>> gzipLevel1Stream(Stream<List<int>> stream) {
return stream.cast<List<int>>().transform<List<int>>(gzipLevel1.encoder);
@@ -230,10 +224,6 @@ class _PosixUtils extends OperatingSystemUtils {
);
}
@override
bool verifyZip(File zipFile) =>
_processUtils.exitsHappySync(<String>['unzip', '-t', '-qq', zipFile.path]);
// tar -xzf tarball -C dest
@override
void unpack(File gzippedTarFile, Directory targetDirectory) {
@@ -243,10 +233,6 @@ class _PosixUtils extends OperatingSystemUtils {
);
}
@override
bool verifyGzip(File gzippedFile) =>
_processUtils.exitsHappySync(<String>['gzip', '-t', gzippedFile.path]);
@override
File makePipe(String path) {
_processUtils.runSync(
@@ -335,18 +321,6 @@ class _WindowsUtils extends OperatingSystemUtils {
_unpackArchive(archive, targetDirectory);
}
@override
bool verifyZip(File zipFile) {
try {
ZipDecoder().decodeBytes(zipFile.readAsBytesSync(), verify: true);
} on FileSystemException catch (_) {
return false;
} on ArchiveException catch (_) {
return false;
}
return true;
}
@override
void unpack(File gzippedTarFile, Directory targetDirectory) {
final Archive archive = TarDecoder().decodeBytes(
@@ -355,20 +329,6 @@ class _WindowsUtils extends OperatingSystemUtils {
_unpackArchive(archive, targetDirectory);
}
@override
bool verifyGzip(File gzipFile) {
try {
GZipDecoder().decodeBytes(gzipFile.readAsBytesSync(), verify: true);
} on FileSystemException catch (_) {
return false;
} on ArchiveException catch (_) {
return false;
} on RangeError catch (_) {
return false;
}
return true;
}
void _unpackArchive(Archive archive, Directory targetDirectory) {
for (final ArchiveFile archiveFile in archive.files) {
// The archive package doesn't correctly set isFile.