diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-09-02 13:58:57 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-09-02 13:58:57 +0200 |
commit | b8adbb9b73751b022b42180dcc213dc99be9765b (patch) | |
tree | 2bbd11f9176a7e7aed21a87a464df2a5a856f8e9 | |
parent | 6381bfdb885def3e532ffae640bb55e5b249819c (diff) | |
download | MultiMC-b8adbb9b73751b022b42180dcc213dc99be9765b.tar MultiMC-b8adbb9b73751b022b42180dcc213dc99be9765b.tar.gz MultiMC-b8adbb9b73751b022b42180dcc213dc99be9765b.tar.lz MultiMC-b8adbb9b73751b022b42180dcc213dc99be9765b.tar.xz MultiMC-b8adbb9b73751b022b42180dcc213dc99be9765b.zip |
GH-1971 do not check filesystem boundaries when committing instances
The check wasn't very good and was breaking because it assumed uniform paths.
-rw-r--r-- | api/logic/FolderInstanceProvider.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/api/logic/FolderInstanceProvider.cpp b/api/logic/FolderInstanceProvider.cpp index ea0d4ef0..88b5bdc6 100644 --- a/api/logic/FolderInstanceProvider.cpp +++ b/api/logic/FolderInstanceProvider.cpp @@ -327,17 +327,14 @@ QString FolderInstanceProvider::getStagedInstancePath() bool FolderInstanceProvider::commitStagedInstance(const QString& keyPath, const QString& path, const QString& instanceName, const QString& groupName) { - if(!path.contains(keyPath)) - { - qWarning() << "It is not possible to commit" << path << "because it is not in" << keyPath; - return false; - } QDir dir; QString instID = FS::DirNameFromString(instanceName, m_instDir); { WatchLock lock(m_watcher, m_instDir); - if(!dir.rename(path, FS::PathCombine(m_instDir, instID))) + QString destination = FS::PathCombine(m_instDir, instID); + if(!dir.rename(path, destination)) { + qWarning() << "Failed to move" << path << "to" << destination; destroyStagingPath(keyPath); return false; } |