Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-31 13:48:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-31 13:48:17 +0300
commitc11b8def68caa0d2a079f393d07d9469a6775238 (patch)
tree4a8bf80b055c94f2a909f883d9d99e3c46ff74bb /lib
parent52d0c8331f2b76d61f8a2747d68aee16f88a2ce6 (diff)
Add latest changes from gitlab-org/security/gitlab@12-4-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/relative_link_filter.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb
index 583b0081319..4f257189f8e 100644
--- a/lib/banzai/filter/relative_link_filter.rb
+++ b/lib/banzai/filter/relative_link_filter.rb
@@ -116,7 +116,7 @@ module Banzai
end
def process_link_to_upload_attr(html_attr)
- path_parts = [Addressable::URI.unescape(html_attr.value)]
+ path_parts = [unescape_and_scrub_uri(html_attr.value)]
if project
path_parts.unshift(relative_url_root, project.full_path)
@@ -172,7 +172,7 @@ module Banzai
end
def cleaned_file_path(uri)
- Addressable::URI.unescape(uri.path).scrub.delete("\0").chomp("/")
+ unescape_and_scrub_uri(uri.path).delete("\0").chomp("/")
end
def relative_file_path(uri)
@@ -184,7 +184,7 @@ module Banzai
def request_path
return unless context[:requested_path]
- Addressable::URI.unescape(context[:requested_path]).chomp("/")
+ unescape_and_scrub_uri(context[:requested_path]).chomp("/")
end
# Convert a relative path into its correct location based on the currently
@@ -266,6 +266,12 @@ module Banzai
def repository
@repository ||= project&.repository
end
+
+ private
+
+ def unescape_and_scrub_uri(uri)
+ Addressable::URI.unescape(uri).scrub
+ end
end
end
end