marinofaggiana 4 years ago
parent
commit
06678efe9e
2 changed files with 9 additions and 7 deletions
  1. 1 1
      Cartfile.resolved
  2. 8 6
      iOSClient/Networking/NCNetworking.swift

+ 1 - 1
Cartfile.resolved

@@ -16,7 +16,7 @@ github "krzyzanowskim/OpenSSL" "1.0.218"
 github "malcommac/SwiftRichString" "3.7.1"
 github "marinofaggiana/AFNetworking" "2967678c3e0e98c9b8d7e06222ad12d1f49c26f2"
 github "marinofaggiana/KTVHTTPCache" "2.0.2"
-github "nextcloud/ios-communication-library" "449172b33bc46dfaa8928db8a99ab21158430a0a"
+github "nextcloud/ios-communication-library" "19bc2a6a8980cc5a0db5002ff72d3d5817a3252f"
 github "realm/realm-cocoa" "v4.4.1"
 github "rechsteiner/Parchment" "v1.7.0"
 github "scenee/FloatingPanel" "v1.7.4"

+ 8 - 6
iOSClient/Networking/NCNetworking.swift

@@ -212,12 +212,14 @@ import NCCommunication
         NCCommunication.sharedInstance.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles(), customUserAgent: nil, addCustomHeaders: nil, account: account) { (account, files, errorCode, errorDescription) in
 
             if errorCode == 0 && files != nil {
-             
-                let file = files![0]
-                let isEncrypted = CCUtility.isFolderEncrypted(file.serverUrl, e2eEncrypted:file.e2eEncrypted, account: account)
-                let metadata = NCManageDatabase.sharedInstance.convertNCFileToMetadata(file, isEncrypted: isEncrypted, account: account)
-                completion(account, metadata, errorCode, "")
-                
+                if files?.count ?? 0 >= 1 {
+                    let file = files![0]
+                    let isEncrypted = CCUtility.isFolderEncrypted(file.serverUrl, e2eEncrypted:file.e2eEncrypted, account: account)
+                    let metadata = NCManageDatabase.sharedInstance.convertNCFileToMetadata(file, isEncrypted: isEncrypted, account: account)
+                    completion(account, metadata, errorCode, "")
+                } else {
+                    completion(account, nil, errorCode, "")
+                }
             } else {
 
                 completion(account, nil, errorCode, errorDescription!)