From 8aaa0d4c135f5a78cb57436a96c55d6b40fd58f3 Mon Sep 17 00:00:00 2001 From: alex-z Date: Sat, 17 Feb 2024 21:04:27 +0100 Subject: [PATCH] Only match file extension not its content for mimetype. Prevents freeze from VFS placeholders. Signed-off-by: alex-z --- src/gui/caseclashfilenamedialog.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/caseclashfilenamedialog.cpp b/src/gui/caseclashfilenamedialog.cpp index cfba3660f1e7b..27ca251a69911 100644 --- a/src/gui/caseclashfilenamedialog.cpp +++ b/src/gui/caseclashfilenamedialog.cpp @@ -88,7 +88,10 @@ CaseClashFilenameDialog::CaseClashFilenameDialog(AccountPtr account, _relativeFilePath = filePathFileInfo.path() + QStringLiteral("/"); _relativeFilePath = _relativeFilePath.replace(folder->path(), QLatin1String()); - _relativeFilePath = _relativeFilePath.isEmpty() ? QString() : _relativeFilePath + QStringLiteral("/"); + _relativeFilePath = _relativeFilePath.isEmpty() ? QString() : _relativeFilePath; + if (!_relativeFilePath.isEmpty() && !_relativeFilePath.endsWith(QStringLiteral("/"))) { + _relativeFilePath += QStringLiteral("/"); + } _originalFileName = _relativeFilePath + conflictFileName; @@ -208,7 +211,7 @@ void CaseClashFilenameDialog::updateFileWidgetGroup(const QString &filePath, const auto fileSizeString = locale().formattedDataSize(filePathFileInfo.size()); const auto fileUrl = QUrl::fromLocalFile(filePath).toString(); const auto linkString = QStringLiteral("%2").arg(fileUrl, linkText); - const auto mime = QMimeDatabase().mimeTypeForFile(_filePath); + const auto mime = QMimeDatabase().mimeTypeForFile(_filePath, QMimeDatabase::MatchExtension); QIcon fileTypeIcon; qCDebug(lcCaseClashConflictFialog) << filePath << filePathFileInfo.exists() << filename << lastModifiedString << fileSizeString << fileUrl << linkString << mime;