From d014293f6d93a34ea021ce287030a1f575f403c3 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Tue, 5 Jan 2021 17:43:31 +0100 Subject: [PATCH] Ensure pathtoUNC is called with an absolute path --- src/common/filesystembase.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/filesystembase.cpp b/src/common/filesystembase.cpp index 9c3c33f30..8bbca4922 100644 --- a/src/common/filesystembase.cpp +++ b/src/common/filesystembase.cpp @@ -18,6 +18,7 @@ #include "filesystembase.h" #include "utility.h" +#include "common/asserts.h" #include #include @@ -509,6 +510,7 @@ bool FileSystem::isJunction(const QString &filename) #ifdef Q_OS_WIN QString FileSystem::pathtoUNC(const QString &_str) { + ASSERT(QFileInfo(_str).isAbsolute()); if (_str.isEmpty()) { return _str; } @@ -522,6 +524,7 @@ QString FileSystem::pathtoUNC(const QString &_str) // prepend \\?\ and to support long names if (str.at(0) == sep) { + // should not happen as we require the path to be absolute return QStringLiteral(R"(\\?)") + str; } return QStringLiteral(R"(\\?\)") + str;