mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Only try upload of modified item in FileProviderExtension if that had its contents changed and we have a valid content url
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
0f2fbf7518
commit
020c5d5104
1 changed files with 50 additions and 37 deletions
|
@ -396,13 +396,25 @@ class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension, NKComm
|
||||||
completionHandler(fpItem, [], false, nil)
|
completionHandler(fpItem, [], false, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if itemTemplateIsFolder {
|
||||||
|
NSLog("Only handling renaming for folders. ocId: %@", item.itemIdentifier.rawValue)
|
||||||
return Progress()
|
return Progress()
|
||||||
} else if itemTemplateIsFolder {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
guard !itemTemplateIsFolder else {
|
||||||
NSLog("System requested modification for folder with ocID %@ (%@) of something other than folder name.", item.itemIdentifier.rawValue, newServerUrlFileName)
|
NSLog("System requested modification for folder with ocID %@ (%@) of something other than folder name.", item.itemIdentifier.rawValue, newServerUrlFileName)
|
||||||
completionHandler(item, [], false, nil)
|
completionHandler(item, [], false, nil)
|
||||||
return Progress()
|
return Progress()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if changedFields.contains(.contents) {
|
||||||
|
guard newContents != nil else {
|
||||||
|
NSLog("WARNING. Could not upload modified contents as was provided nil contents url. ocId: %@", item.itemIdentifier.rawValue)
|
||||||
|
completionHandler(item, [], false, NSFileProviderError(.noSuchItem))
|
||||||
|
return Progress()
|
||||||
|
}
|
||||||
|
|
||||||
self.ncKit.upload(serverUrlFileName: newServerUrlFileName,
|
self.ncKit.upload(serverUrlFileName: newServerUrlFileName,
|
||||||
fileNameLocalPath: fileNameLocalPath,
|
fileNameLocalPath: fileNameLocalPath,
|
||||||
requestHandler: { _ in
|
requestHandler: { _ in
|
||||||
|
@ -445,6 +457,7 @@ class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension, NKComm
|
||||||
|
|
||||||
completionHandler(fpItem, [], false, nil)
|
completionHandler(fpItem, [], false, nil)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Progress()
|
return Progress()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue