Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • G gitlab-ce
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • nexedinexedi
  • gitlab-ce
  • Repository
You need to sign in or sign up before continuing.
  • gitlab-ce
  • spec
  • controllers
  • groups
  • uploads_controller_spec.rb
Find file BlameHistoryPermalink
  • Stan Hu's avatar
    Fix upload redirections when project has moved · 6775f193
    Stan Hu authored Jan 10, 2020
    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
    6775f193
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7