Skip to content

Commit

Permalink
Properly handle metadata delete after item deletion in FileProviderEx…
Browse files Browse the repository at this point in the history
…tension

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Mar 20, 2023
1 parent 1630e86 commit 265d386
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,12 @@ class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension, NKComm
Logger.fileTransfer.info("Successfully deleted item with identifier: \(identifier.rawValue, privacy: .public) at: \(serverFileNameUrl, privacy: OSLogPrivacy.auto(mask: .hash))")

if itemMetadata.directory {
dbManager.deleteDirectoryAndSubdirectoriesMetadata(ocId: ocId)
}

if dbManager.localFileMetadataFromOcId(ocId) != nil {
dbManager.deleteLocalFileMetadata(ocId: ocId)
_ = dbManager.deleteDirectoryAndSubdirectoriesMetadata(ocId: ocId)
} else {
dbManager.deleteItemMetadata(ocId: ocId)
if dbManager.localFileMetadataFromOcId(ocId) != nil {
dbManager.deleteLocalFileMetadata(ocId: ocId)
}
}

completionHandler(nil)
Expand Down

0 comments on commit 265d386

Please sign in to comment.