Skip to content

Commit

Permalink
Only match file extension not its content for mimetype. Prevents free…
Browse files Browse the repository at this point in the history
…ze from VFS placeholders.

Signed-off-by: alex-z <[email protected]>
  • Loading branch information
allexzander authored and mgallien committed Feb 22, 2024
1 parent 47d1800 commit 8aaa0d4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/gui/caseclashfilenamedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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("<a href='%1'>%2</a>").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;
Expand Down

0 comments on commit 8aaa0d4

Please sign in to comment.