File download from package registry fails when `+` is used in the package path
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=581168) </details> <!--IssueSummary end--> <!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "type::bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary File download fails with the below error if `+` character is used in the package name, uploading it works fine: When we use the path below: ``` /api/v4/projects/:id/packages/generic/github.com/mirror/xx/xx/releases/download/21.0.9+11/xx-x+11-linux-amd64.tar.gz ``` We get encoded path: ``` xx%xx%2Freleases%2Fdownload%2F21.0.9%2B11%2Fxx-x21.0.9%2B11-linux-amd64.tar.gz ``` If we try to download the file we get the error: ``` "exception.class": "Gitlab::Utils::DoubleEncodingError", "exception.message": "path xx%xx%2Freleases%2Fdownload%2F21.0.9%2B11%2Fxx-x21.0.9%2B11-linux-amd64.tar.gz is not allowed", ``` When we replace the `+` with `-` file download works fine. This appears to happen when the path is double decoded here: https://gitlab.com/gitlab-org/gitlab/-/blob/master/gems/gitlab-utils/lib/gitlab/utils.rb#L20 And once the path is decoded a second time we get spaces in the path, hence probably the error: ``` xx/xx/releases/download/21.0.9 11/xx-x21.0.9 11-linux-amd64.tar.gz ``` According to the documentation `+` character should be allowed: https://docs.gitlab.com/user/packages/generic_packages/#valid-package-filename-format #### Results of GitLab environment info GitLab version: 18.5.2 [GitLab internal ZD](https://gitlab.zendesk.com/agent/tickets/672252) <!-- If you don't have /label privileges, follow up with an issue comment of `@gitlab-bot label ~"type::bug"` -->
issue