mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-23 04:41:16 +00:00
Properly validate folder ID (fixes #156).
This commit is contained in:
parent
42c8898c80
commit
322a297c5e
2 changed files with 4 additions and 4 deletions
|
@ -195,8 +195,8 @@ public class FolderSettingsFragment extends PreferenceFragment
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.create:
|
||||
if (mFolder.ID.equals("")) {
|
||||
Toast.makeText(getActivity(), R.string.folder_id_required, Toast.LENGTH_LONG)
|
||||
if (mFolder.ID.length() > 64 || !mFolder.ID.matches("[a-zA-Z0-9-_\\.]+")) {
|
||||
Toast.makeText(getActivity(), R.string.folder_id_invalid, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@
|
|||
<!-- Dialog shown when attempting to delete a folder -->
|
||||
<string name="delete_folder_confirm">Do you really want to delete this folder?</string>
|
||||
|
||||
<!-- Toast shown when trying to create a folder with an empty ID -->
|
||||
<string name="folder_id_required">The folder ID must not be empty</string>
|
||||
<!-- Toast shown when trying to create a folder with an invalid ID -->
|
||||
<string name="folder_id_invalid">The folder ID must be a short identifier (64 characters or less) consisting of letters, numbers and the dot (.), dash (-) and underscode (_) characters only.</string>
|
||||
|
||||
<!-- Toast shown when trying to create a folder with an empty path -->
|
||||
<string name="folder_path_required">The folder path must not be empty</string>
|
||||
|
|
Loading…
Reference in a new issue