Skip to content

Commit

Permalink
fix: make urls ending in /* also match the base path
Browse files Browse the repository at this point in the history
Fixes #834
  • Loading branch information
connor4312 authored and digeff committed Nov 9, 2020
1 parent 7657cdf commit 0f0ae54
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he
- fix: support chrome dev and beta builds ([ref](https://github.com/OmniSharp/omnisharp-vscode/issues/4108))
- fix: race causing potentially corrupted log files ([#825](https://github.com/microsoft/vscode-js-debug/issues/825))
- fix: extension host debugging pausing in internals ([ref](https://github.com/microsoft/vscode/issues/105047))
- fix: make urls ending in `/*` also match the base path ([#834](https://github.com/microsoft/vscode-js-debug/issues/834))

## v1.51.0 - 2020-10-26

Expand Down
22 changes: 15 additions & 7 deletions src/test/common/urlUtils.test.ts → src/common/urlUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
import { expect } from 'chai';
import { SinonStub, stub } from 'sinon';
import { promises as dns } from 'dns';
import * as os from 'os';
import { SinonStub, stub } from 'sinon';
import {
fileUrlToAbsolutePath,
createTargetFilter,
urlToRegex,
setCaseSensitivePaths,
resetCaseSensitivePaths,
fileUrlToAbsolutePath,
isLoopback,
} from '../../common/urlUtils';
resetCaseSensitivePaths,
setCaseSensitivePaths,
urlToRegex,
} from './urlUtils';

describe('urlUtils', () => {
describe('fileUrlToPath()', () => {
Expand Down Expand Up @@ -173,11 +173,19 @@ describe('urlUtils', () => {
it('respects one wildcard', () => {
testAll('localhost/site/*', [
['http://localhost/site/app', true],
['http://localhost/site/', false],
['http://localhost/site/', true],
['http://localhost/', false],
]);
});

it('makes wildcard optional (#834)', () => {
testAll('localhost/*', [
['http://localhost/site/', true],
['http://localhost/', true],
['http://localhost', true],
]);
});

it('respects wildcards with query params', () => {
testAll('localhost:3000/site/?*', [
['http://localhost:3000/site/?blah=1', true],
Expand Down
2 changes: 1 addition & 1 deletion src/common/urlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ export const createTargetFilter = (
};

const escaped = targetUrls.map(url =>
escapeRegexSpecialChars(standardizeMatch(url), '/*').replace(/\*/g, '.*'),
escapeRegexSpecialChars(standardizeMatch(url), '/*').replace(/(\/\*$)|\*/g, '.*'),
);
const targetUrlRegex = new RegExp('^(' + escaped.join('|') + ')$', 'g');

Expand Down

0 comments on commit 0f0ae54

Please sign in to comment.