Skip to content

Commit

Permalink
fix(go): Escape dot for regexes produced for GONOPROXY (#12357)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov committed Oct 27, 2021
1 parent 17e7022 commit 159acb0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/datasource/go/goproxy.spec.ts
Expand Up @@ -98,6 +98,7 @@ describe('datasource/go/goproxy', () => {
expect(parseNoproxy('[abc]')?.source).toEqual('^(?:[abc])$');
expect(parseNoproxy('[a-c]')?.source).toEqual('^(?:[a-c])$');
expect(parseNoproxy('[\\a-\\c]')?.source).toEqual('^(?:[a-c])$');
expect(parseNoproxy('a.b.c')?.source).toEqual('^(?:a\\.b\\.c)$');
});

it('matches on real package prefixes', () => {
Expand Down
5 changes: 4 additions & 1 deletion lib/datasource/go/goproxy.ts
Expand Up @@ -79,7 +79,10 @@ const lexer = moo.states({
push: 'characterRange',
value: (_: string) => '[',
},
char: /[^*?\\[\n]/, // TODO #12070
char: {
match: /[^*?\\[\n]/,
value: (s: string) => s.replace(regEx('\\.', 'g'), '\\.'),
},
escapedChar: {
match: /\\./, // TODO #12070
value: (s: string) => s.slice(1),
Expand Down

0 comments on commit 159acb0

Please sign in to comment.