Disallow illegal chars in templates

This commit is contained in:
Michael Bucari-Tovo 2022-06-23 16:36:56 -06:00
parent 7e00162ef2
commit bc9625fece

View File

@ -54,10 +54,7 @@ namespace LibationFileManager
if (template is null)
return new[] { ERROR_NULL_IS_INVALID };
if (template.Contains(':')
|| template.Contains(Path.DirectorySeparatorChar)
|| template.Contains(Path.AltDirectorySeparatorChar)
)
if (ReplacementCharacters.ContainsInvalid(template.Replace("<","").Replace(">","")))
return new[] { ERROR_INVALID_FILE_NAME_CHAR };
return Valid;
@ -200,6 +197,10 @@ namespace LibationFileManager
if (template.Contains(':'))
return new[] { ERROR_FULL_PATH_IS_INVALID };
// must be relative. no colons. all other path chars are valid enough to pass this check and will be handled on final save.
if (ReplacementCharacters.ContainsInvalid(template.Replace("<", "").Replace(">", "")))
return new[] { ERROR_INVALID_FILE_NAME_CHAR };
return Valid;
}