Skip to content

Commit

Permalink
fix(homebrew): handle new github archive url format
Browse files Browse the repository at this point in the history
Old archive urls were in form: https://github.com/<owner/<repo>/archive/<tag>.tar.gz
New ones are in form: https://github.com/<owner/<repo>/archive/refs/tags/<tag>.tar.gz

So with the current parsing `currentValue` ends up being filled with
the `refs` string instead of the tag value.

This change handles both forms by checking the length of the url paths
slice.
  • Loading branch information
nikaro committed May 17, 2024
1 parent 8216f20 commit 97faf64
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/modules/manager/homebrew/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,15 @@ export function parseUrlPath(
const repoName = s[1];
let currentValue: string | undefined;
if (s[2] === 'archive') {
currentValue = s[3];
if (s.length === 4) {
// old archive url in form: [...]/archive/<tag>.tar.gz
currentValue = s[3];
} else if (s.length === 6) {
// new archive url in form: [...]/archive/refs/tags/<tag>.tar.gz
currentValue = s[5];
} else {
return null;
}
const targz = currentValue.slice(
currentValue.length - 7,
currentValue.length,
Expand Down

0 comments on commit 97faf64

Please sign in to comment.