提交 fe699b5c 编写于 作者: R Rob Lourens

Fix #69739 - Respect '..' and '../' in "Files to include"

上级 de81ccf0
......@@ -230,7 +230,7 @@ export class QueryBuilder {
parseSearchPaths(pattern: string): ISearchPathsInfo {
const isSearchPath = (segment: string) => {
// A segment is a search path if it is an absolute path or starts with ./, ../, .\, or ..\
return path.isAbsolute(segment) || /^\.\.?[\/\\]/.test(segment);
return path.isAbsolute(segment) || /^\.\.?([\/\\]|$)/.test(segment);
};
const segments = splitGlobPattern(pattern)
......@@ -339,7 +339,7 @@ export class QueryBuilder {
const workspaceUri = this.workspaceContextService.getWorkspace().folders[0].uri;
searchPath = normalizeSlashes(searchPath);
if (strings.startsWith(searchPath, '../')) {
if (strings.startsWith(searchPath, '../') || searchPath === '..') {
const resolvedPath = path.posix.resolve(workspaceUri.path, searchPath);
return [{
searchPath: workspaceUri.with({ path: resolvedPath })
......
......@@ -667,6 +667,14 @@ suite('QueryBuilder', () => {
}]
}
],
[
'..',
{
searchPaths: [{
searchPath: getUri('/foo')
}]
}
],
[
'..\\bar',
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册