diff options
author | marinofaggiana <marino@marinofaggiana.com> | 2020-07-21 15:38:02 +0300 |
---|---|---|
committer | marinofaggiana <marino@marinofaggiana.com> | 2020-07-21 15:38:02 +0300 |
commit | 0a6d204543b418829652caed2d963b9fec4ad305 (patch) | |
tree | 7166bd8314a86c445cc92a600bd6cccd6f3e3482 /File Provider Extension | |
parent | b0b1c81db6c1e91525e16c4bf46904305051fa1d (diff) |
coding
Diffstat (limited to 'File Provider Extension')
-rw-r--r-- | File Provider Extension/FileProviderExtension+Actions.swift | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/File Provider Extension/FileProviderExtension+Actions.swift b/File Provider Extension/FileProviderExtension+Actions.swift index 4b91b2557..b1aa84fba 100644 --- a/File Provider Extension/FileProviderExtension+Actions.swift +++ b/File Provider Extension/FileProviderExtension+Actions.swift @@ -171,13 +171,19 @@ extension FileProviderExtension { let fileNameFrom = metadata.fileNameView let fileNamePathFrom = metadata.serverUrl + "/" + fileNameFrom let fileNamePathTo = metadata.serverUrl + "/" + itemName + let ocId = metadata.ocId NCCommunication.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePathFrom, serverUrlFileNameDestination: fileNamePathTo, overwrite: false) { (account, errorCode, errorDescription) in if errorCode == 0 { // Rename metadata - NCManageDatabase.sharedInstance.renameMetadata(fileNameTo: itemName, ocId: metadata.ocId) + NCManageDatabase.sharedInstance.renameMetadata(fileNameTo: itemName, ocId: ocId) + + guard let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", ocId)) else { + completionHandler(nil, NSFileProviderError(.noSuchItem)) + return + } if metadata.directory { @@ -194,7 +200,7 @@ extension FileProviderExtension { _ = fileProviderUtility.sharedInstance.moveFile(CCUtility.getDirectoryProviderStorageIconOcId(itemIdentifier.rawValue, etag: metadata.etag), toPath: CCUtility.getDirectoryProviderStorageIconOcId(itemIdentifier.rawValue, etag: metadata.etag)) - NCManageDatabase.sharedInstance.setLocalFile(ocId: metadata.ocId, date: nil, exifDate: nil, exifLatitude: nil, exifLongitude: nil, fileName: itemName, etag: nil) + NCManageDatabase.sharedInstance.setLocalFile(ocId: ocId, date: nil, exifDate: nil, exifLatitude: nil, exifLongitude: nil, fileName: itemName, etag: nil) } guard let parentItemIdentifier = fileProviderUtility.sharedInstance.getParentItemIdentifier(metadata: metadata, homeServerUrl: fileProviderData.sharedInstance.homeServerUrl) else { @@ -202,7 +208,7 @@ extension FileProviderExtension { return } - let item = FileProviderItem(metadata: metadata, parentItemIdentifier: parentItemIdentifier) + let item = FileProviderItem(metadata: metadata.freeze(), parentItemIdentifier: parentItemIdentifier) completionHandler(item, nil) } else { |