Skip to content

Incorrect redirect when download_site_uri is present #160

Description

@Poundex

It seems when packages have the download_site_uri set (which doesn't seem to be common) then hitting the /redirect for that particular package will redirect to download_site_uri instead of direct_download_uri, even when direct_download_uri is present and correct.

GET https://api.foojay.io/disco/v3.0/ids/9d7cb147358cf7ea8e0ff46dfbc38c36

HTTP/2 200 OK

{
  "result": [
    {
      "filename": "graalvm-community-jdk-25i1-25.0.3_linux-x64_bin.tar.gz",
      "direct_download_uri": "https://github.com/graalvm/graalvm-ce-builds/releases/download/graal-25.1.3/graalvm-community-jdk-25i1-25.0.3_linux-x64_bin.tar.gz",
      "download_site_uri": "https://github.com/graalvm/graalvm-ce-builds/releases",
      "signature_uri": "",
      "checksum_uri": "https://github.com/graalvm/graalvm-ce-builds/releases/download/graal-25.1.3/graalvm-community-jdk-25i1-25.0.3_linux-x64_bin.tar.gz.sha256",
      "checksum": "e9cd1637be853e105f8b09125b4b19fbce385696465d782cbca8bb80e1df8f0d",
      "checksum_type": "sha256"
    }
  ],
  "message": ""
}

but

GET https://api.foojay.io/disco/v3.0/ids/9d7cb147358cf7ea8e0ff46dfbc38c36/redirect

HTTP/2 301 Moved Permanently

location: https://github.com/graalvm/graalvm-ce-builds/releases

And so the resulting download ends up with the HTML content of the GitHub releases page, which naturally doesn't work

 Some toolchain resolvers had provisioning failures: foojay (Unable to download toolchain matching the requirements ({languageVersion=25, vendor=GraalVM Community, implementation=vendor-specific, nativeImageCapable=false}) from 'https://api.foojay.io/disco/v3.0/ids/9d7cb147358cf7ea8e0ff46dfbc38c36/redirect', due to: Cannot expand TAR '~/.gradle/jdks/releases-GraalVM-Community-25'.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions