mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-03 07:51:12 +03:00
fix: properly handle character sets in globs (#24371)
https://github.com/microsoft/playwright/issues/24316
This commit is contained in:
parent
b4c412eb1f
commit
fee08a6d3b
@ -51,6 +51,12 @@ export function globToRegex(glob: string): RegExp {
|
||||
case '?':
|
||||
tokens.push('.');
|
||||
break;
|
||||
case '[':
|
||||
tokens.push('[');
|
||||
break;
|
||||
case ']':
|
||||
tokens.push(']');
|
||||
break;
|
||||
case '{':
|
||||
inGroup = true;
|
||||
tokens.push('(');
|
||||
|
@ -91,12 +91,14 @@ it('should work with glob', async () => {
|
||||
expect(globToRegex('http://localhost:3000/signin-oidc*').test('http://localhost:3000/signin-oidc/foo')).toBeFalsy();
|
||||
expect(globToRegex('http://localhost:3000/signin-oidc*').test('http://localhost:3000/signin-oidcnice')).toBeTruthy();
|
||||
|
||||
expect(globToRegex('**/three-columns/settings.html?**id=[a-z]**').test('http://mydomain:8080/blah/blah/three-columns/settings.html?id=settings-e3c58efe-02e9-44b0-97ac-dd138100cf7c&blah')).toBeTruthy();
|
||||
|
||||
expect(globToRegex('\\?')).toEqual(/^\?$/);
|
||||
expect(globToRegex('\\')).toEqual(/^\\$/);
|
||||
expect(globToRegex('\\\\')).toEqual(/^\\$/);
|
||||
expect(globToRegex('\\[')).toEqual(/^\[$/);
|
||||
expect(globToRegex('[')).toEqual(/^\[$/);
|
||||
expect(globToRegex('$^+.\\*()|\\?\\{\\}[]')).toEqual(/^\$\^\+\.\*\(\)\|\?\{\}\[\]$/);
|
||||
expect(globToRegex('[a-z]')).toEqual(/^[a-z]$/);
|
||||
expect(globToRegex('$^+.\\*()|\\?\\{\\}\\[\\]')).toEqual(/^\$\^\+\.\*\(\)\|\?\{\}\[\]$/);
|
||||
});
|
||||
|
||||
it('should intercept network activity from worker', async function({ page, server, isAndroid, browserName, browserMajorVersion }) {
|
||||
|
Loading…
Reference in New Issue
Block a user