Browse Source

check account

Marino Faggiana 6 years ago
parent
commit
d3f9e27134
1 changed files with 7 additions and 0 deletions
  1. 7 0
      PickerFileProvider/FileProvider.swift

+ 7 - 0
PickerFileProvider/FileProvider.swift

@@ -166,6 +166,11 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
             throw NSError(domain: NSCocoaErrorDomain, code: NSFileNoSuchFileError, userInfo:[:])
         }
 
+        // Check account
+        if setupActiveAccount() == false {
+            throw NSFileProviderError(.notAuthenticated)
+        }
+        
         if identifier == .rootContainer {
             
             if let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account = %@ AND serverUrl = %@", account, homeServerUrl)) {
@@ -192,6 +197,8 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
                     let item = FileProviderItem(metadata: metadata!, parentItemIdentifier: parentItemIdentifier!)
                     return item
                 }
+            } else {
+                throw NSFileProviderError(.noSuchItem)
             }
         }