Retain format when redirecting moved projects

What does this MR do and why?

Retain format when redirecting moved projects

While accessing the API we check if the project has been moved and redirect to the same path with the project's old full path exchanged with the project's ID.

Previously this logic would not retain the format segment of the URL i.e. https://gitlab.com/api/v4/project/moved/repositories/archive.zip would redirect to https://gitlab.com/api/v4/project/moved/repositories/archive omitting the .zip extension.

This change fixes the logic to ensure we include the format when forwarding.

References

Fixes Archive downloads redirect ignores file extension (#578087 - closed)

How to set up and validate locally

Move a project and then use curl to get the archive using curl to show the response curl -sS -D - https://urltogdk.test/api/v4/projects/#{project.full_path from before the rename}/repository/archive.zip and note that you are not redirected

Merge request reports

Loading