If the user tries to delete the movie component of a live photo, redownload this
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 30 Oct 2024 03:03:02 +0000 (11:03 +0800)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 20 Nov 2024 13:39:51 +0000 (14:39 +0100)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/libsync/discovery.cpp

index 00a0a44b225f04f42645b017ccec83d549b20503..b4e4b0434966d2e788d942930c1f75abda0a0696 100644 (file)
@@ -1122,6 +1122,12 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
                 qCWarning(lcDisco) << "Failed to delete a file record from the local DB" << path._original;
             }
             return;
+        } else if (serverEntry.isLivePhoto && QMimeDatabase().mimeTypeForFile(item->_file).inherits(QStringLiteral("video/quicktime"))) {
+            // This is a live photo's video file; the server won't allow deletion of this file
+            // so we need to *not* propagate the .mov deletion to the server and redownload the file
+            qCInfo(lcDisco) << "Live photo video file deletion detected, redownloading" << item->_file;
+            item->_direction = SyncFileItem::Down;
+            item->_instruction = CSYNC_INSTRUCTION_SYNC;
         } else if (!serverModified) {
             // Removed locally: also remove on the server.
             if (!dbEntry._serverHasIgnoredFiles) {