Added further filename validation
- Now checks for forbidden characters
This commit is contained in:
parent
52ddcdddc3
commit
6a17c0a81c
|
@ -58,9 +58,10 @@ namespace BFR
|
||||||
|
|
||||||
// Validate that there are any changes, and that the new file names are all unique.
|
// Validate that there are any changes, and that the new file names are all unique.
|
||||||
IsCommitButtonEnabled =
|
IsCommitButtonEnabled =
|
||||||
Files.Any(x => x.Path != x.OldPath) // Check for changes
|
Files.Any(x => x.Path != x.OldPath) // Check for changes
|
||||||
&& Files.GroupBy(x => x.Path).All(g => g.Count() == 1) // Check for duplicates
|
&& Files.GroupBy(x => x.Path).All(g => g.Count() == 1) // Check for duplicates
|
||||||
&& !Files.Any(x => x.FullName == ""); // Check for invalid file names; TODO: Further validation
|
&& !Files.Any(x => x.FullName == "") // Check for empty file names
|
||||||
|
&& !Files.Any(x => "?%*:<>|/\\\"".Any(y => x.FullName.Contains(y))); // Check for invalid characters
|
||||||
|
|
||||||
// Refresh the file list to guarantee that changes are displayed. TODO: Find a better way to do this.
|
// Refresh the file list to guarantee that changes are displayed. TODO: Find a better way to do this.
|
||||||
Files.ReplaceAll(new List<FileModel>(Files));
|
Files.ReplaceAll(new List<FileModel>(Files));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user