Browse Source

first

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
3f58617185

+ 1 - 0
iOSClient/Data/NCDatabase.swift

@@ -260,6 +260,7 @@ class tableDirectEditingEditors: Object {
 class tableDirectory: Object {
 
     @objc dynamic var account = ""
+    @objc dynamic var color: String?
     @objc dynamic var e2eEncrypted: Bool = false
     @objc dynamic var etag = ""
     @objc dynamic var favorite: Bool = false

+ 1 - 1
iOSClient/NCGlobal.swift

@@ -113,7 +113,7 @@ class NCGlobal: NSObject {
     // Database Realm
     //
     let databaseDefault                             = "nextcloud.realm"
-    let databaseSchemaVersion: UInt64               = 230
+    let databaseSchemaVersion: UInt64               = 232
 
     // Intro selector
     //

+ 1 - 1
iOSClient/Utility/CCUtility.m

@@ -1383,7 +1383,7 @@
             if (directory.e2eEncrypted == true) {
                 return true;
             }
-            serverUrl = [[NCUtilityFileSystem shared]  deletingLastPathComponentWithAccount:account serverUrl:serverUrl];
+            serverUrl = [[NCUtilityFileSystem shared] deletingLastPathComponentWithAccount:account serverUrl:serverUrl];
             directory = [[NCManageDatabase shared] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", account, serverUrl]];
         }
         

+ 3 - 4
iOSClient/Utility/NCUtilityFileSystem.swift

@@ -173,10 +173,9 @@ class NCUtilityFileSystem: NSObject {
     }
 
     @objc func deletingLastPathComponent(account: String, serverUrl: String) -> String {
-        if getHomeServer(account: account) == serverUrl { return serverUrl }
-        let fileName = (serverUrl as NSString).lastPathComponent
-        let serverUrl = serverUrl.replacingOccurrences(of: "/"+fileName, with: "", options: String.CompareOptions.backwards, range: nil)
-        return serverUrl
+
+        guard getHomeServer(account: account) != serverUrl, let url = URL(string: serverUrl) else { return serverUrl }
+        return String(url.deletingLastPathComponent().absoluteString.dropLast())
     }
 
     @objc func createFileName(_ fileName: String, serverUrl: String, account: String) -> String {