diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-02-28 12:36:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-28 12:36:49 +0100 |
commit | 38bfd2fda6901981c5f183dc202e0010b3f683d6 (patch) | |
tree | 6d1a77f0876534524604d5fb45a4373b776a1bf8 | |
parent | f2003b1a7e5d3fce6448bd578a15bbf8f9462183 (diff) | |
parent | 8e98be5991f04a850dfd9371cff160101927e0b5 (diff) |
Merge pull request #26383 from neikeq/issue-26302
Sanitize file paths before extracting export templates
-rw-r--r-- | editor/export_template_manager.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index ad3ce90afd..97ccfb0db1 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -270,7 +270,7 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ char fname[16384]; unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0); - String file_path(fname); + String file_path(String(fname).simplify_path()); String file = file_path.get_file(); @@ -287,10 +287,10 @@ bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ unzReadCurrentFile(pkg, data.ptrw(), data.size()); unzCloseCurrentFile(pkg); - String base_dir = file_path.get_base_dir().trim_suffix("/").trim_suffix("\\"); + String base_dir = file_path.get_base_dir().trim_suffix("/"); if (base_dir != contents_dir && base_dir.begins_with(contents_dir)) { - base_dir = base_dir.substr(contents_dir.length(), file_path.length()).trim_prefix("/").trim_prefix("\\"); + base_dir = base_dir.substr(contents_dir.length(), file_path.length()).trim_prefix("/"); file = base_dir.plus_file(file); DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); |