summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-01-18 16:29:00 +0000
committerNick Thomas <nick@gitlab.com>2018-01-18 17:32:19 +0000
commit3b0235318ef1fd39311910da7eb1893a4d3ae312 (patch)
tree02c5597d014dd28cf9914c4f246e3d9a874f01bd /lib/banzai
parente56bcf92774b19115f62b609163c44ba9d919e69 (diff)
downloadgitlab-ce-3b0235318ef1fd39311910da7eb1893a4d3ae312.tar.gz
Correctly escape UTF-8 path elements for uploads
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/relative_link_filter.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb
index f6169b2c85d..9bdedeb6615 100644
--- a/lib/banzai/filter/relative_link_filter.rb
+++ b/lib/banzai/filter/relative_link_filter.rb
@@ -50,7 +50,7 @@ module Banzai
end
def process_link_to_upload_attr(html_attr)
- path_parts = [html_attr.value]
+ path_parts = [Addressable::URI.unescape(html_attr.value)]
if group
path_parts.unshift(relative_url_root, 'groups', group.full_path, '-')
@@ -58,13 +58,13 @@ module Banzai
path_parts.unshift(relative_url_root, project.full_path)
end
- path = File.join(*path_parts)
+ path = Addressable::URI.escape(File.join(*path_parts))
html_attr.value =
if context[:only_path]
path
else
- URI.join(Gitlab.config.gitlab.base_url, path).to_s
+ Addressable::URI.join(Gitlab.config.gitlab.base_url, path).to_s
end
end