Ignore directory entries in TPZ

Zip files may contain directory entries, they always end with a path
separator and zip entries always use forward slashes for path separators.

There's no need to create the directories included in the zip file,
since they'll already be created when creating the individual files.
This commit is contained in:
Raul Santos 2023-07-12 14:36:12 +02:00
parent 83cc5d4914
commit 59a5a1eb70
No known key found for this signature in database
GPG Key ID: B532473AE3A803E4
1 changed files with 7 additions and 0 deletions

View File

@ -465,6 +465,13 @@ bool ExportTemplateManager::_install_file_selected(const String &p_file, bool p_
break;
}
if (String::utf8(fname).ends_with("/")) {
// File is a directory, ignore it.
// Directories will be created when extracting each file.
ret = unzGoToNextFile(pkg);
continue;
}
String file_path(String::utf8(fname).simplify_path());
String file = file_path.get_file();