瀏覽代碼

improvements

Marino Faggiana 7 年之前
父節點
當前提交
9400b16351
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. 7 3
      PickerFileProvider/FileProvider.swift

+ 7 - 3
PickerFileProvider/FileProvider.swift

@@ -102,7 +102,7 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
         let fileName = url.lastPathComponent
         let directoryUser = CCUtility.getDirectoryActiveUser(result.user, activeUrl: result.url)
         let destinationURLDirectoryUser = URL(string: "file://\(directoryUser!)/\(fileName)".addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)!)!
-        let serverUrl = CCUtility.getHomeServerUrlActiveUrl(result.url)
+        var serverUrl = CCUtility.getHomeServerUrlActiveUrl(result.url)
 
         // copy sourceURL on directoryUser
         do {
@@ -118,9 +118,13 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
             return
         }
 
-        
+        // Get serverUrl
         if let fileID = CCUtility.getFileIDPicker() {
-            
+            if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", fileID)) {
+                if metadata.fileName == fileName {
+                    serverUrl = NCManageDatabase.sharedInstance.getServerUrl(metadata.directoryID)
+                }
+            }
         }
         
         //TODO: verifica se esiste già in coda