mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-24 08:15:51 +01:00
Merge pull request #105108 from DavidGoldman/master
Terminal: Support linking local file paths containing '+'
This commit is contained in:
+2
-2
@@ -20,14 +20,14 @@ const pathPrefix = '(\\.\\.?|\\~)';
|
||||
const pathSeparatorClause = '\\/';
|
||||
// '":; are allowed in paths but they are often separators so ignore them
|
||||
// Also disallow \\ to prevent a catastropic backtracking case #24798
|
||||
const excludedPathCharactersClause = '[^\\0\\s!$`&*()\\[\\]+\'":;\\\\]';
|
||||
const excludedPathCharactersClause = '[^\\0\\s!$`&*()\\[\\]\'":;\\\\]';
|
||||
/** A regex that matches paths in the form /foo, ~/foo, ./foo, ../foo, foo/bar */
|
||||
export const unixLocalLinkClause = '((' + pathPrefix + '|(' + excludedPathCharactersClause + ')+)?(' + pathSeparatorClause + '(' + excludedPathCharactersClause + ')+)+)';
|
||||
|
||||
export const winDrivePrefix = '(?:\\\\\\\\\\?\\\\)?[a-zA-Z]:';
|
||||
const winPathPrefix = '(' + winDrivePrefix + '|\\.\\.?|\\~)';
|
||||
const winPathSeparatorClause = '(\\\\|\\/)';
|
||||
const winExcludedPathCharactersClause = '[^\\0<>\\?\\|\\/\\s!$`&*()\\[\\]+\'":;]';
|
||||
const winExcludedPathCharactersClause = '[^\\0<>\\?\\|\\/\\s!$`&*()\\[\\]\'":;]';
|
||||
/** A regex that matches paths in the form \\?\c:\foo c:\foo, ~\foo, .\foo, ..\foo, foo\bar */
|
||||
export const winLocalLinkClause = '((' + winPathPrefix + '|(' + winExcludedPathCharactersClause + ')+)?(' + winPathSeparatorClause + '(' + winExcludedPathCharactersClause + ')+)+)';
|
||||
|
||||
|
||||
+6
-2
@@ -19,7 +19,9 @@ const unixLinks = [
|
||||
'./foo',
|
||||
'../foo',
|
||||
'/foo/bar',
|
||||
'foo/bar'
|
||||
'/foo/bar+more',
|
||||
'foo/bar',
|
||||
'foo/bar+more',
|
||||
];
|
||||
|
||||
const windowsLinks = [
|
||||
@@ -33,10 +35,12 @@ const windowsLinks = [
|
||||
'~/foo',
|
||||
'c:/foo/bar',
|
||||
'c:\\foo\\bar',
|
||||
'c:\\foo\\bar+more',
|
||||
'c:\\foo/bar\\baz',
|
||||
'foo/bar',
|
||||
'foo/bar',
|
||||
'foo\\bar'
|
||||
'foo\\bar',
|
||||
'foo\\bar+more',
|
||||
];
|
||||
|
||||
interface LinkFormatInfo {
|
||||
|
||||
Reference in New Issue
Block a user