Sfoglia il codice sorgente

#2064

Signed-off-by: Marino Faggiana <96728420+MarinoFaggianaAstraIridium@users.noreply.github.com>
Marino Faggiana 2 anni fa
parent
commit
24f8a57173

+ 6 - 0
iOSClient/Rename file/NCRenameFile.swift

@@ -231,6 +231,12 @@ class NCRenameFile: UIViewController, UITextFieldDelegate {
 
     func renameMetadata(_ metadata: tableMetadata, fileNameNew: String) {
 
+        // verify if already exists
+        if NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@", metadata.account, metadata.serverUrl, fileNameNew)) != nil {
+            NCContentPresenter.shared.showError(error: NKError(errorCode: 0, errorDescription: "_rename_already_exists_"))
+            return
+        }
+
         NCActivityIndicator.shared.start()
 
         NCNetworking.shared.renameMetadata(metadata, fileNameNew: fileNameNew, viewController: self) { error in

+ 1 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -927,6 +927,7 @@
 "_unauthorizedFilesPasscode_" = "Files cannot be used with an activated passcode";
 "_disableFilesApp_"         = "Files cannot be used because it is disabled";
 "_reset_application_done_"  = "Reset application, done.";
+"_rename_already_exists_"   = "A file with this name already exists";
 
 // Video
 "_select_trace_"            = "Select the trace";