Skip to content

Commit 1c97da0

Browse files
authored
Fix empty filename not checked (#3693)
* Add localizable Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com> * Trim whitespaces Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com> --------- Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
1 parent 81ab70a commit 1c97da0

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

iOSClient/Extensions/UIAlertController+Extension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ extension UIAlertController {
216216

217217
let oldExtension = fileName.fileExtension
218218

219-
let text = alertController.textFields?.first?.text ?? ""
219+
let text = alertController.textFields?.first?.text?.trimmingCharacters(in: .whitespaces) ?? ""
220220
let textCheck = FileNameValidator.checkFileName(text, account: account, capabilities: capabilities)
221221
var message = textCheck?.error.localizedDescription ?? ""
222222
var messageColor = UIColor.red

iOSClient/Supporting Files/en.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ You can stop it at any time, adjust the settings, and enable it again.";
703703
"_file_name_validator_error_invalid_character_" = "Name contains an invalid character: \"%@\".";
704704
"_file_name_validator_error_space_" = "Name must not contain spaces at the beginning or end.";
705705
"_file_name_new_extension_" = "Changing the extension might cause this file to open in a different application.";
706+
"_file_name_empty_" = "File name cannot be empty.";
706707
"_please_rename_file_" = "Please rename the file or folder.";
707708
"hidden_file_name_warning" = "Name will result in a hidden file.";
708709

0 commit comments

Comments
 (0)