summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroyuki Sato <sathiroyuki@gmail.com>2015-07-27 15:29:10 +0900
committerHiroyuki Sato <sathiroyuki@gmail.com>2015-07-27 16:18:12 +0900
commit1cd28600652e23c8605b9344e269c34e83edccd1 (patch)
tree3d5b14446cd08d222b4c81c483207cb95faf6789
parent8be3d1204eabc2db9a18cda01578282b617ceddf (diff)
downloadgitlab-ce-1cd28600652e23c8605b9344e269c34e83edccd1.tar.gz
Fix the image file that contains non-ascii character is not displayed
-rw-r--r--CHANGELOG1
-rw-r--r--lib/gitlab/markdown/relative_link_filter.rb5
2 files changed, 4 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index e198b48e86e..808f66b9483 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased)
+ - Fix the image file that contains non-ascii character is not displayed(Hiroyuki Sato)
- Fix URL used for refreshing notes if relative_url is present (Bartłomiej Święcki)
- Fix Error 500 when browsing projects with no HEAD (Stan Hu)
- Fix full screen mode for snippet comments (Daniel Gerhardt)
diff --git a/lib/gitlab/markdown/relative_link_filter.rb b/lib/gitlab/markdown/relative_link_filter.rb
index 9de2b24a9da..3eaceba5323 100644
--- a/lib/gitlab/markdown/relative_link_filter.rb
+++ b/lib/gitlab/markdown/relative_link_filter.rb
@@ -98,9 +98,10 @@ module Gitlab
#
# Returns a String
def path_type(path)
- if repository.tree(current_sha, path).entries.any?
+ unescaped_path = Addressable::URI.unescape(path)
+ if repository.tree(current_sha, unescaped_path).entries.any?
'tree'
- elsif repository.blob_at(current_sha, path).try(:image?)
+ elsif repository.blob_at(current_sha, unescaped_path).try(:image?)
'raw'
else
'blob'