NOISSUE normalize instances path in FolderInstanceProvider

This resolves some issues with the instance export dialog when the instances folder
path contains '..' and '.', or involves symlinks.
This commit is contained in:
Petr Mrázek 2017-12-03 02:38:53 +01:00
parent 34de313feb
commit 30fad998a6

View File

@ -34,7 +34,8 @@ struct WatchLock
FolderInstanceProvider::FolderInstanceProvider(SettingsObjectPtr settings, const QString& instDir)
: BaseInstanceProvider(settings)
{
m_instDir = instDir;
// Normalize path
m_instDir = QDir(instDir).canonicalPath();
if (!QDir::current().exists(m_instDir))
{
QDir::current().mkpath(m_instDir);
@ -281,7 +282,7 @@ void FolderInstanceProvider::instanceDirContentsChanged(const QString& path)
void FolderInstanceProvider::on_InstFolderChanged(const Setting &setting, QVariant value)
{
QString newInstDir = value.toString();
QString newInstDir = QDir(value.toString()).canonicalPath();
if(newInstDir != m_instDir)
{
if(m_groupsLoaded)