Skip to content

Commit 831fba0

Browse files
authored
fix(terraform): Escape literal . in Bitbucket module ref regex (#26452)
1 parent f6cf9a4 commit 831fba0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/modules/manager/terraform/extractors/others/modules.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ describe('modules/manager/terraform/extractors/others/modules', () => {
148148
const subfolderWithDoubleSlash = bitbucketRefMatchRegex.exec(
149149
'bitbucket.org/hashicorp/example.git//terraform?ref=v1.0.0',
150150
)?.groups;
151+
const subfolderWithGitInName = bitbucketRefMatchRegex.exec(
152+
'bitbucket.org/hashicorp/example.git//terraform-git?ref=v1.0.0',
153+
)?.groups;
151154
const depth = bitbucketRefMatchRegex.exec(
152155
'git::https://git@bitbucket.org/hashicorp/example.git?depth=1&ref=v1.0.0',
153156
)?.groups;
@@ -180,6 +183,11 @@ describe('modules/manager/terraform/extractors/others/modules', () => {
180183
project: 'example',
181184
tag: 'v1.0.0',
182185
});
186+
expect(subfolderWithGitInName).toMatchObject({
187+
workspace: 'hashicorp',
188+
project: 'example',
189+
tag: 'v1.0.0',
190+
});
183191
expect(depth).toMatchObject({
184192
workspace: 'hashicorp',
185193
project: 'example',

lib/modules/manager/terraform/extractors/others/modules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const githubRefMatchRegex = regEx(
1313
/github\.com([/:])(?<project>[^/]+\/[a-z0-9-_.]+).*\?(depth=\d+&)?ref=(?<tag>.*?)(&depth=\d+)?$/i,
1414
);
1515
export const bitbucketRefMatchRegex = regEx(
16-
/(?:git::)?(?<url>(?:http|https|ssh)?(?::\/\/)?(?:.*@)?(?<path>bitbucket\.org\/(?<workspace>.*)\/(?<project>.*).git\/?(?<subfolder>.*)))\?(depth=\d+&)?ref=(?<tag>.*?)(&depth=\d+)?$/,
16+
/(?:git::)?(?<url>(?:http|https|ssh)?(?::\/\/)?(?:.*@)?(?<path>bitbucket\.org\/(?<workspace>.*)\/(?<project>.*)\.git\/?(?<subfolder>.*)))\?(depth=\d+&)?ref=(?<tag>.*?)(&depth=\d+)?$/,
1717
);
1818
export const gitTagsRefMatchRegex = regEx(
1919
/(?:git::)?(?<url>(?:(?:http|https|ssh):\/\/)?(?:.*@)?(?<path>.*\/(?<project>.*\/.*)))\?(depth=\d+&)?ref=(?<tag>.*?)(&depth=\d+)?$/,

0 commit comments

Comments
 (0)