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
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-11-27 01:07:55 +0300
committerStan Hu <stanhu@gmail.com>2018-11-27 01:14:48 +0300
commite8da70e66ca15e91ba9a1ffd553f7657eb2e90ff (patch)
tree2a973ea20861ea3a48c914a1647feb334bbadbd2 /app/helpers/tree_helper.rb
parentdeaf3af7e5f357f3e8d91f7f2d49ad3ce001ba68 (diff)
Fix handling of filenames with hash characters in tree view
Addressable::URI interprets the `#` in a URI as a URI fragment and does not escape it, but Rails has special helpers that treats these as bona-fide characters that need to be escaped. Closes https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23368
Diffstat (limited to 'app/helpers/tree_helper.rb')
-rw-r--r--app/helpers/tree_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index 78a11616d4c..e2879bfdcf1 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -37,13 +37,13 @@ module TreeHelper
# Using Rails `*_path` methods can be slow, especially when generating
# many paths, as with a repository tree that has thousands of items.
def fast_project_blob_path(project, blob_path)
- Addressable::URI.escape(
+ ActionDispatch::Journey::Router::Utils.escape_path(
File.join(relative_url_root, project.path_with_namespace, 'blob', blob_path)
)
end
def fast_project_tree_path(project, tree_path)
- Addressable::URI.escape(
+ ActionDispatch::Journey::Router::Utils.escape_path(
File.join(relative_url_root, project.path_with_namespace, 'tree', tree_path)
)
end