mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-03-06 19:42:46 +07:00
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:
@@ -244,12 +244,13 @@ export async function filterList(tools_list: string[]): Promise<string[]> {
|
||||
* @param data
|
||||
*/
|
||||
export async function getUrl(data: ToolInput): Promise<string> {
|
||||
if ((data.version ?? 'latest') === 'latest') {
|
||||
const version = data.version ?? 'latest';
|
||||
if (version === 'latest' || version === '') {
|
||||
return [
|
||||
data.domain,
|
||||
data.repository,
|
||||
data.prefix,
|
||||
data.version,
|
||||
'latest',
|
||||
data.verb,
|
||||
data.tool + data.extension
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user