don't use ArchiveFile.isFile

This commit is contained in:
Adam Velebil 2023-02-21 14:15:40 +01:00
parent 4231c40fde
commit 3158165a7e
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10

View File

@ -151,17 +151,17 @@ class IconPackManager extends ChangeNotifier {
final destination =
Directory('${tempDirectory.path}ex${Platform.pathSeparator}');
final archive = ZipDecoder().decodeBytes(bytes);
final archive = ZipDecoder().decodeBytes(bytes, verify: true);
for (final file in archive) {
final filename = file.name;
if (file.isFile) {
if (file.size > 0) {
final data = file.content as List<int>;
_log.debug('Writing file: ${destination.path}$filename');
_log.debug('Writing file: ${destination.path}$filename (size: ${file.size})');
final extractedFile = File('${destination.path}$filename');
final createdFile = await extractedFile.create(recursive: true);
await createdFile.writeAsBytes(data);
} else {
_log.debug('Writing directory: ${destination.path}$filename');
_log.debug('Writing directory: ${destination.path}$filename (size: ${file.size})');
Directory('${destination.path}$filename').createSync(recursive: true);
}
}