Skip to content

Commit

Permalink
Correctly validate \\?\%VAR% format
Browse files Browse the repository at this point in the history
Var resolution isn't supported, but it will now be recognized as a absolute path
and prevent broken links

Fixes #94961
  • Loading branch information
Tyriar committed Apr 29, 2020
1 parent 23a1ee8 commit 507345d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const excludedPathCharactersClause = '[^\\0\\s!$`&*()\\[\\]+\'":;\\\\]';
/** A regex that matches paths in the form /foo, ~/foo, ./foo, ../foo, foo/bar */
const unixLocalLinkClause = '((' + pathPrefix + '|(' + excludedPathCharactersClause + ')+)?(' + pathSeparatorClause + '(' + excludedPathCharactersClause + ')+)+)';

const winDrivePrefix = '(?:\\\\\\\\\\?\\\\)?[a-zA-Z]:';
// Valid absolute formats: C:, \\?\C: and \\?\%VAR%
const winDrivePrefix = '(?:\\\\\\\\\\?\\\\)?([a-zA-Z]:|%)';
const winPathPrefix = '(' + winDrivePrefix + '|\\.\\.?|\\~)';
const winPathSeparatorClause = '(\\\\|\\/)';
const winExcludedPathCharactersClause = '[^\\0<>\\?\\|\\/\\s!$`&*()\\[\\]+\'":;]';
Expand Down

0 comments on commit 507345d

Please sign in to comment.