Proparser: Don't crash on accidental remote files

Change-Id: I62ca1b17436fce21d582816388db497d82df6582
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-06-25 08:55:09 +02:00
parent 6a826bd751
commit d1300542bb

View File

@@ -48,6 +48,18 @@ using namespace QMakeInternal;
IoUtils::FileType IoUtils::fileType(const QString &fileName)
{
// FIXME:
if (fileName.startsWith("docker:/")) {
if (!fileName.startsWith("docker://"))
qWarning("File name not canonical");
int pos = fileName.indexOf('/', 10);
if (pos == 0) {
qWarning("File name not canonical");
return FileNotFound;
}
return fileType(fileName.mid(pos));
}
Q_ASSERT(fileName.isEmpty() || isAbsolutePath(fileName));
#ifdef Q_OS_WIN
DWORD attr = GetFileAttributesW((WCHAR*)fileName.utf16());