Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #7164

Closed
Open
Created Jun 20, 2014 by Administrator@rootOwner

Yet another relative_url_root + avatar_url issue

Created by: julian7

I upgraded gitlab to 7.0, just to find out avatar uploads are broken, as they don't honor relative_url_path. AFAIK the regression was introduced by ae564c97.

If I'm not mistaken the old behavior was controlled at client side, but now it's constructed at server side.

However, URI::join doesn't work the same way as + operator with javascript strings:

irb(main):052:0> URI::join("http://example.com", "uploads").to_s
=> "http://example.com/uploads"
irb(main):053:0> URI::join("http://example.com/gitlab", "uploads").to_s
=> "http://example.com/uploads"
irb(main):054:0> URI::join("http://example.com/gitlab/", "uploads").to_s
=> "http://example.com/gitlab/uploads"
irb(main):055:0> URI::join("http://example.com", "/uploads").to_s
=> "http://example.com/uploads"
irb(main):056:0> URI::join("http://example.com/gitlab", "/uploads").to_s
=> "http://example.com/uploads"
irb(main):057:0> URI::join("http://example.com/gitlab/", "/uploads").to_s
=> "http://example.com/uploads"

According to this, the only way to get the correct URL if you either end your base URL with a slash, and you don't start additional parts with slash. Alternatively, we can also prepend AttachmentUploader's default_url with relative_url_root.

Assignee
Assign to
Time tracking