Browse Source

improvement

Marino Faggiana 7 năm trước cách đây
mục cha
commit
e968874d6f
1 tập tin đã thay đổi với 5 bổ sung3 xóa
  1. 5 3
      PickerFileProvider/FileProvider.swift

+ 5 - 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)!)!
-        var serverUrl = CCUtility.getHomeServerUrlActiveUrl(result.url)
+        var serverUrl : String?
 
         // copy sourceURL on directoryUser
         do {
@@ -126,9 +126,11 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
                 }
             }
         }
+        if serverUrl == nil {
+            serverUrl = CCUtility.getHomeServerUrlActiveUrl(result.url)
+        }
         
-        // verifica se esiste già in coda
-        
+        // Verify if already exists in tableMetadata (session)
         if NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileName == %@ AND serverUrl == %@ AND session == %@", fileName, serverUrl!, k_upload_session_foreground)) == nil {
             
             CCNetworking.shared().settingDelegate(self)