From: Kevin Ottens Date: Tue, 29 Dec 2020 14:11:33 +0000 (+0100) Subject: Don't look at virtual files data for the mimetype matches X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~447^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e37a5f36b0cd494d95b5f6770cf5690efdfafb95;p=nextcloud-desktop.git Don't look at virtual files data for the mimetype matches Otherwise this would attempt to download the file everytime we check the direct editor for a given file which wouldn't be adequate. Would also lead to a deadlock in our case since that would happen in the main thread and implicit hydration is driven from there as well. Signed-off-by: Kevin Ottens --- diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 3be2d1455..b1b4e7eaa 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -1178,8 +1178,11 @@ DirectEditor* SocketApi::getDirectEditorForLocalFile(const QString &localFile) auto capabilities = fileData.folder->accountState()->account()->capabilities(); if (fileData.folder && fileData.folder->accountState()->isConnected()) { + const auto record = fileData.journalRecord(); + const auto mimeMatchMode = record.isVirtualFile() ? QMimeDatabase::MatchExtension : QMimeDatabase::MatchDefault; + QMimeDatabase db; - QMimeType type = db.mimeTypeForFile(localFile); + QMimeType type = db.mimeTypeForFile(localFile, mimeMatchMode); DirectEditor* editor = capabilities.getDirectEditorForMimetype(type); if (!editor) {