GH-1971 do not check filesystem boundaries when committing instances
The check wasn't very good and was breaking because it assumed uniform paths.
This commit is contained in:
parent
6381bfdb88
commit
b8adbb9b73
@ -327,17 +327,14 @@ QString FolderInstanceProvider::getStagedInstancePath()
|
|||||||
bool FolderInstanceProvider::commitStagedInstance(const QString& keyPath, const QString& path, const QString& instanceName,
|
bool FolderInstanceProvider::commitStagedInstance(const QString& keyPath, const QString& path, const QString& instanceName,
|
||||||
const QString& groupName)
|
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;
|
QDir dir;
|
||||||
QString instID = FS::DirNameFromString(instanceName, m_instDir);
|
QString instID = FS::DirNameFromString(instanceName, m_instDir);
|
||||||
{
|
{
|
||||||
WatchLock lock(m_watcher, 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);
|
destroyStagingPath(keyPath);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user