Properly handle metadata delete after item deletion in FileProviderExtension

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-03-20 14:56:41 +01:00
parent c088f0eb81
commit 7550ed7a1b
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -580,12 +580,13 @@ class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension, NKComm
Logger.fileTransfer.info("Successfully deleted item with identifier: \(identifier.rawValue, privacy: .public) at: \(serverFileNameUrl, privacy: OSLogPrivacy.auto(mask: .hash))") Logger.fileTransfer.info("Successfully deleted item with identifier: \(identifier.rawValue, privacy: .public) at: \(serverFileNameUrl, privacy: OSLogPrivacy.auto(mask: .hash))")
if itemMetadata.directory { if itemMetadata.directory {
dbManager.deleteDirectoryAndSubdirectoriesMetadata(ocId: ocId) _ = dbManager.deleteDirectoryAndSubdirectoriesMetadata(ocId: ocId)
} } else {
dbManager.deleteItemMetadata(ocId: ocId)
if dbManager.localFileMetadataFromOcId(ocId) != nil { if dbManager.localFileMetadataFromOcId(ocId) != nil {
dbManager.deleteLocalFileMetadata(ocId: ocId) dbManager.deleteLocalFileMetadata(ocId: ocId)
} }
}
completionHandler(nil) completionHandler(nil)
} }