marinofaggiana 5 жил өмнө
parent
commit
7b7212ab00

+ 6 - 3
iOSClient/Main/CCMain.m

@@ -1295,7 +1295,9 @@
         if (errorCode == 0 ) {
             
             _metadataFolder = metadataFolder;
+            BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl e2eEncrypted:_metadataFolder.e2eEncrypted account:appDelegate.activeAccount];
             [self setTitle];
+            
 
             // File is changed ??
             /*
@@ -1307,7 +1309,8 @@
             */
             
             // E2EE Is encrypted folder get metadata
-            if (_metadataFolder.e2eEncrypted) {
+            
+            if (isFolderEncrypted) {
                 NSString *metadataFolderFileId = metadataFolder.fileId;
                 // Read Metadata
                 if ([CCUtility isEndToEndEnabled:account]) {
@@ -3209,7 +3212,7 @@
             viewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"CCMain"];
             
             viewController.serverUrl = serverUrlPush;
-            viewController.titleMain = metadata.fileName;
+            viewController.titleMain = metadata.fileNameView;
             viewController.blinkFileNamePath = blinkFileNamePath;
             
             // save self
@@ -3221,7 +3224,7 @@
            
             if (viewController.isViewLoaded) {
                 
-                viewController.titleMain = metadata.fileName;
+                viewController.titleMain = metadata.fileNameView;
                 viewController.blinkFileNamePath = blinkFileNamePath;
                 
                 // Fix : Application tried to present modally an active controller

+ 9 - 3
iOSClient/Utility/CCUtility.m

@@ -1436,11 +1436,17 @@
         return true;
         
     } else {
+       
+        tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@  AND serverUrl == %@", account, serverUrl]];
         
-        NSArray *directories = [[NCManageDatabase sharedInstance] getTablesDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND e2eEncrypted == 1 AND serverUrl BEGINSWITH %@", account, serverUrl] sorted:@"serverUrl" ascending:false];
-        for (tableDirectory *directory in directories) {
-            if ([serverUrl containsString:directory.serverUrl])
+        while (directory != nil) {
+            if (directory.e2eEncrypted == true) {
                 return true;
+            }
+            NSURL *url = [NSURL URLWithString:serverUrl];
+            serverUrl = [url URLByDeletingLastPathComponent].absoluteString;
+            serverUrl = [serverUrl substringToIndex:[serverUrl length]-1];
+            directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@  AND serverUrl == %@", account, serverUrl]];
         }
         
         return false;