Browse Source

Fix checking valid folder names, fix check order (first rm invalid char, then trim)

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 years ago
parent
commit
c601534b90
1 changed files with 2 additions and 2 deletions
  1. 2 2
      iOSClient/Extensions/UIAlertController+Extension.swift

+ 2 - 2
iOSClient/Extensions/UIAlertController+Extension.swift

@@ -58,8 +58,8 @@ extension UIAlertController {
             object: alertController.textFields?.first,
             queue: .main) { _ in
                 guard let text = alertController.textFields?.first?.text,
-                      let folderName = CCUtility.removeForbiddenCharactersServer(text.trimmingCharacters(in: .whitespacesAndNewlines)) else { return }
-                okAction.isEnabled = !folderName.isEmpty
+                      let folderName = CCUtility.removeForbiddenCharactersServer(text)?.trimmingCharacters(in: .whitespaces) else { return }
+                okAction.isEnabled = !folderName.isEmpty && folderName != "." && folderName != ".."
             }
 
         alertController.addAction(cancelAction)