mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-02 10:10:28 +08:00
GitHub and GitLab will prefix archive payloads with the name of the repo and the refspec. This patch naively applies a prefix in similar fashion. The refspec might contain filesystem path separators, like a forward slash (`/`). GitHub and GitLab replace that with a hyphen (`-`). This patch applies that same replacement. The file name that is suggested to browsers (via the HTTP header `Content-Disposition`) is changed to match the prefix. The additional archive formats `tar` and `zip` are now supported as well. Users that relied on the archive *not* carrying the prefix introduced here, may pass the query `?prefix=false` to get the old behavior. This does not affect the `Content-Disposition` header, though. Users who relied on the downloaded file be named in a certain way after, and also used the file name from `Content-Disposition` for the name, cannot get back the old behavior, but must instead rename the file. Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.dev>