Fix upload redirections when project has moved
Previously if a user attempted to click on a link to an attachment for a renamed project (e.g. https://gitlab-org/gitlab-ce/uploads/123.png), Rails would redirect the user to an erroneous URL (e.g. https://gitlab-org/gitlab-foss/uploads/123.png.png). Notice the redirect URL contains a redundant extension. It turns out Rails 5 parses the extension of a route as the format (https://github.com/rails/rails/issues/28901#issuecomment-297747521), and the URL generator appends the format to the redirected route. To fix this, we need to disable the format path parameter and explicitly set the format to `nil`. If we do not set the format to `nil`, the URL generator will append a query string (e.g `?format=png`), which would still work but not necessary. Closes https://gitlab.com/gitlab-org/gitlab/issues/196232
Showing
Please register or sign in to comment