From 427e28c034138e3e9250f8a0cdef7f61529820e3 Mon Sep 17 00:00:00 2001 From: HJfod Date: Sat, 20 Jan 2024 22:15:58 +0200 Subject: [PATCH] fix Zip::Impl::extractAt not making sure dest dir exists --- loader/src/utils/file.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/loader/src/utils/file.cpp b/loader/src/utils/file.cpp index ecb87c62..a62264bc 100644 --- a/loader/src/utils/file.cpp +++ b/loader/src/utils/file.cpp @@ -306,7 +306,8 @@ public: mz_zip_entry_close(m_handle); - GEODE_UNWRAP(file::writeBinary(dir / name, res)); + GEODE_UNWRAP(file::createDirectoryAll(dir)); + GEODE_UNWRAP(file::writeBinary(dir / name, res).expect("Unable to write to {}: {error}", dir / name)); return Ok(); } @@ -336,10 +337,12 @@ public: #endif if (m_entries.at(filePath).isDirectory) { GEODE_UNWRAP(file::createDirectoryAll(dir / filePath)); - } else { + } + else { GEODE_UNWRAP(this->extractAt(dir, filePath)); } - } else { + } + else { log::error( "Zip entry '{}' is not contained within zip bounds", dir / filePath