fix: use latest in URL when version is empty

When version is not specified (empty string), the getUrl function
was generating invalid URLs like /releases/download/cs2pr without
any version, which returned 404.

This fix ensures that when version is empty or 'latest', the URL
includes '/latest/' which GitHub handles correctly with a redirect
to the actual latest release.

Fixes #1063
This commit is contained in:
theluckystrike
2026-03-04 22:03:38 +07:00
parent a8ca9e3783
commit 746e1a46d1
4 changed files with 5 additions and 16 deletions

View File

@@ -260,7 +260,7 @@ describe('Tools tests', () => {
};
data.extension = '';
expect(await tools.getUrl(data)).toBe(
'https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/download/cs2pr'
'https://github.com/staabm/annotate-pull-request-from-checkstyle/releases/latest/download/cs2pr'
);
});