Merge pull request #3981 from Snarling/B&AFix

FILES: FIX #3979 Allow characters & and ' in filenames
This commit is contained in:
hydroflame 2022-08-23 12:25:55 -03:00 committed by GitHub
commit d553a1d2f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,7 +38,7 @@ export function removeTrailingSlash(s: string): string {
export function isValidFilename(filename: string): boolean { export function isValidFilename(filename: string): boolean {
// Allows alphanumerics, hyphens, underscores, and percentage signs // Allows alphanumerics, hyphens, underscores, and percentage signs
// Must have a file extension // Must have a file extension
const regex = /^[.a-zA-Z0-9_-]+[.][a-zA-Z0-9]+(?:-\d+(?:\.\d*)?%-INC)?$/; const regex = /^[.&'a-zA-Z0-9_-]+\.[a-zA-Z0-9]+(?:-\d+(?:\.\d*)?%-INC)?$/;
// match() returns null if no match is found // match() returns null if no match is found
return filename.match(regex) != null; return filename.match(regex) != null;