mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 08:06:04 +00:00
Merge pull request #184608 from microsoft/tyriar/183958
Exclude query strings from detected local links
This commit is contained in:
commit
fef218690d
2 changed files with 34 additions and 1 deletions
|
@ -293,7 +293,7 @@ enum RegexPathConstants {
|
|||
PathSeparatorClause = '\\/',
|
||||
// '":; are allowed in paths but they are often separators so ignore them
|
||||
// Also disallow \\ to prevent a catastropic backtracking case #24795
|
||||
ExcludedPathCharactersClause = '[^\\0<>\\s!`&*()\'":;\\\\]',
|
||||
ExcludedPathCharactersClause = '[^\\0<>\\?\\s!`&*()\'":;\\\\]',
|
||||
ExcludedStartPathCharactersClause = '[^\\0<>\\s!`&*()\\[\\]\'":;\\\\]',
|
||||
|
||||
WinOtherPathPrefix = '\\.\\.?|\\~',
|
||||
|
|
|
@ -478,6 +478,39 @@ suite('TerminalLinkParsing', () => {
|
|||
}
|
||||
});
|
||||
|
||||
suite('query strings', () => {
|
||||
for (const os of operatingSystems) {
|
||||
test(`should exclude query strings from link paths ${osLabel[os]}`, () => {
|
||||
deepStrictEqual(
|
||||
detectLinks(`${osTestPath[os]}?a=b`, os),
|
||||
[
|
||||
{
|
||||
path: {
|
||||
index: 0,
|
||||
text: osTestPath[os]
|
||||
},
|
||||
prefix: undefined,
|
||||
suffix: undefined
|
||||
}
|
||||
] as IParsedLink[]
|
||||
);
|
||||
deepStrictEqual(
|
||||
detectLinks(`${osTestPath[os]}?a=b&c=d`, os),
|
||||
[
|
||||
{
|
||||
path: {
|
||||
index: 0,
|
||||
text: osTestPath[os]
|
||||
},
|
||||
prefix: undefined,
|
||||
suffix: undefined
|
||||
}
|
||||
] as IParsedLink[]
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
suite('should detect file names in git diffs', () => {
|
||||
test('--- a/foo/bar', () => {
|
||||
deepStrictEqual(
|
||||
|
|
Loading…
Reference in a new issue