Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Name Validator Improvements #13577

Merged
merged 8 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class FileNameValidatorTests : AbstractOnServerIT() {
assertEquals(null, result2)
} else {
assertEquals(
targetContext.getString(R.string.file_name_validator_error_forbidden_file_extensions, " "),
targetContext.getString(R.string.file_name_validator_error_forbidden_space_character_extensions),
result
)
assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,16 @@ object FileNameValidator {
forbiddenFilenameExtensionJson?.let {
for (forbiddenExtension in forbiddenFilenameExtension()) {
if (filename.endsWith(forbiddenExtension, ignoreCase = true)) {
return context.getString(
R.string.file_name_validator_error_forbidden_file_extensions,
forbiddenExtension
)
return if (forbiddenExtension == StringConstants.SPACE) {
context.getString(
R.string.file_name_validator_error_forbidden_space_character_extensions
)
} else {
context.getString(
R.string.file_name_validator_error_forbidden_file_extensions,
forbiddenExtension
)
}
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1235,13 +1235,14 @@
<string name="unified_search_fragment_calendar_event_not_found">Event not found, you can always sync to update. Redirecting to web…</string>
<string name="unified_search_fragment_contact_not_found">Contact not found, you can always sync to update. Redirecting to web…</string>
<string name="unified_search_fragment_permission_needed">Permissions are required to open search result otherwise it will redirected to web…</string>
<string name="file_name_validator_current_path_is_invalid">Current folder name is invalid, please rename the folder. Redirecting to root</string>
<string name="file_name_validator_current_path_is_invalid">Current folder name is invalid, please rename the folder. Redirecting home…</string>
<string name="file_name_validator_rename_before_move_or_copy">%s. Please rename the file before moving or copying</string>
<string name="file_name_validator_upload_content_error">Some contents cannot able to uploaded due to contains reserved names or invalid character</string>
<string name="file_name_validator_error_contains_reserved_names_or_invalid_characters">Folder path contains reserved names or invalid character</string>
<string name="file_name_validator_error_invalid_character">Name contains an invalid character: %s</string>
<string name="file_name_validator_upload_content_error">Some content cannot be uploaded since it contains reserved names or invalid characters</string>
alperozturk96 marked this conversation as resolved.
Show resolved Hide resolved
<string name="file_name_validator_error_contains_reserved_names_or_invalid_characters">Folder path contains reserved names or invalid characters</string>
<string name="file_name_validator_error_invalid_character">Name contains invalid characters: %s</string>
<string name="file_name_validator_error_reserved_names">%s is a forbidden name</string>
<string name="file_name_validator_error_forbidden_file_extensions">%s is a forbidden file extension</string>
<string name="file_name_validator_error_forbidden_space_character_extensions">Filenames must not contain spaces at the beginning or end</string>
<string name="sync">Sync</string>
<string name="please_select_a_server">Please select a server…</string>
</resources>
Loading