diff --git a/packages/service-worker/config/src/glob.ts b/packages/service-worker/config/src/glob.ts index 802189d09e..e886296cd2 100644 --- a/packages/service-worker/config/src/glob.ts +++ b/packages/service-worker/config/src/glob.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -const WILD_SINGLE = '[^\\/]+'; +const WILD_SINGLE = '[^\\/]*'; const WILD_OPEN = '(?:.+\\/)?'; const TO_ESCAPE = [ diff --git a/packages/service-worker/config/test/generator_spec.ts b/packages/service-worker/config/test/generator_spec.ts index 75047119bf..d7252af471 100644 --- a/packages/service-worker/config/test/generator_spec.ts +++ b/packages/service-worker/config/test/generator_spec.ts @@ -81,7 +81,7 @@ import {MockFilesystem} from '../testing/mock'; patterns: [ '\\/absolute\\/.*', '\\/some\\/url\\?with\\+escaped\\+chars', - '\\/test\\/relative\\/[^\\/]+\\.txt', + '\\/test\\/relative\\/[^\\/]*\\.txt', ] }], dataGroups: [{ @@ -97,7 +97,7 @@ import {MockFilesystem} from '../testing/mock'; {positive: true, regex: '^\\/included\\/absolute\\/.*$'}, {positive: false, regex: '^\\/excluded\\/absolute\\/.*$'}, {positive: true, regex: '^\\/included\\/some\\/url\\?with\\+escaped\\+chars$'}, - {positive: false, regex: '^\\/test\\/excluded\\/relative\\/[^\\/]+\\.txt$'}, + {positive: false, regex: '^\\/test\\/excluded\\/relative\\/[^\\/]*\\.txt$'}, {positive: true, regex: '^http:\\/\\/example\\.com\\/included$'}, {positive: false, regex: '^http:\\/\\/example\\.com\\/excluded$'}, ], @@ -129,8 +129,9 @@ import {MockFilesystem} from '../testing/mock'; dataGroups: [], navigationUrls: [ {positive: true, regex: '^\\/.*$'}, - {positive: false, regex: '^\\/(?:.+\\/)?[^\\/]+\\.[^\\/]+$'}, - {positive: false, regex: '^\\/(?:.+\\/)?[^\\/]+__[^\\/]+\\/.*$'}, + {positive: false, regex: '^\\/(?:.+\\/)?[^\\/]*\\.[^\\/]*$'}, + {positive: false, regex: '^\\/(?:.+\\/)?[^\\/]*__[^\\/]*$'}, + {positive: false, regex: '^\\/(?:.+\\/)?[^\\/]*__[^\\/]*\\/.*$'}, ], hashTable: {} }); diff --git a/packages/service-worker/worker/test/happy_spec.ts b/packages/service-worker/worker/test/happy_spec.ts index 423751be78..87a57c67e7 100644 --- a/packages/service-worker/worker/test/happy_spec.ts +++ b/packages/service-worker/worker/test/happy_spec.ts @@ -688,6 +688,12 @@ const manifestUpdateHash = sha1(JSON.stringify(manifestUpdate)); expect(await navRequest('/baz/x__x/qux')).toBeNull(); server.assertSawRequestFor('/baz/x__x/qux'); + + expect(await navRequest('/baz/__')).toBeNull(); + server.assertSawRequestFor('/baz/__'); + + expect(await navRequest('/baz/__/qux')).toBeNull(); + server.assertSawRequestFor('/baz/__/qux'); }); describe('(with custom `navigationUrls`)', () => {