Skip to content
Snippets Groups Projects

Do not escape URI when extracting path

2 unresolved threads

What does this MR do?

  • remove escaping of URI parameters after they have already been unescaped in ExtractsPath
  • remove spec that is relying on that behavior

Why was this MR needed?

  • spaces in directory names were escaped leading to 404 errors on repository files page

What are the relevant issue numbers?

fixes gitlab-com/support-forum#952 (closed), #21106 (closed)

Screenshot

fixed

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
94 94 @options = params.select {|key, value| allowed_options.include?(key) && !value.blank? }
95 95 @options = HashWithIndifferentAccess.new(@options)
96 96
97 @id = Addressable::URI.normalize_component(get_id)
  • 30 30 expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb")
    31 31 end
    32 32
    33 context 'escaped slash character in ref' do
    34 let(:ref) { 'improve%2Fawesome' }
    35
    36 it 'has no escape sequences in @ref or @logs_path' do
    37 assign_ref_vars
    38
    39 expect(@ref).to eq('improve/awesome')
    40 expect(@logs_path).to eq("/#{@project.path_with_namespace}/refs/#{ref}/logs_tree/files/ruby/popen.rb")
    41 end
    42 end
    43
  • @rspeicher Can you please take a look at this?

    @stanhu and me discussed the encoding of the slashes because Apache and nginx handle them differently by default. We decided to go for the nginx version which unencodes the slashes for us, i.e. https://gitlab.com/gitlab-org/gitlab-ce/tree/with%2Fslash would lead to params[:id] = 'with/slash'. Apache by default returns error 404. This can be changed by setting AllowEncodedSlashes to On (which adopts the behavior of nginx). The behavior of On changed with introducing NoDecode in 2.2.18 or 2.3.12.

    We should probably mention this setting in the release blog post.

    See also @stanhu's original comment: https://gitlab.com/gitlab-org/gitlab-ce/issues/1804#note_1386456

    I explicitly linked the English version of the Apache docs above (and not the translated one) because at least the German translation does not contain the NoDecode option yet.

    Edited by username-removed-14714
  • Minimum required Apache version for NoDecode would be 2.2.18 or 2.3.12.

  • I fixed the comment above, mixed up On and NoDecode again. 😒 Prior to 2.2.18 or 2.3.12 On had the behavior that NoDecode has now (compare 2.0 docs). So these Apache versions won't work.

  • Added 232 commits:

  • mentioned in issue #20946 (closed)

  • Robert Speicher Milestone changed to %8.11

    Milestone changed to %8.11

  • Robert Speicher Added ~149423 label

    Added ~149423 label

  • @winniehell Please resolve conflicts.

  • Robert Speicher Assignee removed

    Assignee removed

  • Reassigned to @winniehell

  • @rspeicher resolved 🎉

  • Added 76 commits:

  • Removed repository label

  • Robert Speicher mentioned in commit daa0cc1c

    mentioned in commit daa0cc1c

  • Robert Speicher Status changed to merged

    Status changed to merged

  • Picked into 8-11-stable, will go into 8.11.0-rc6.

  • Rubén Dávila Removed ~149423 label

    Removed ~149423 label

  • Robert Speicher mentioned in commit ebc9d34d

    mentioned in commit ebc9d34d

  • username-removed-386624 Resolved all discussions

    Resolved all discussions

  • mentioned in issue #21334 (closed)

  • Douwe Maan mentioned in merge request !5974 (merged)

    mentioned in merge request !5974 (merged)

  • Douwe Maan mentioned in commit 910da231

    mentioned in commit 910da231

  • mentioned in merge request !6050 (merged)

  • Mentioned in commit bb48a0fa

  • Mentioned in issue #22400 (closed)

  • Mentioned in merge request !6050 (merged)

  • Please register or sign in to reply
    Loading