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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 21:07:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 21:07:48 +0300
commite72386771751fb22245bc6604fef236a2ee130cb (patch)
tree7cf54bca933159cb177d3caa2f139f87d6d30391 /lib/banzai
parentc2b98d3dbd47ab92c79c702276fe9130d9a28036 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/relative_link_filter.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb
index 583b0081319..2581a179c79 100644
--- a/lib/banzai/filter/relative_link_filter.rb
+++ b/lib/banzai/filter/relative_link_filter.rb
@@ -152,11 +152,18 @@ module Banzai
def rebuild_relative_uri(uri)
file_path = nested_file_path_if_exists(uri)
+ resource_type = uri_type(file_path)
+
+ # Repository routes are under /-/ scope now.
+ # Since we craft a path without using route helpers we must
+ # ensure - is added here.
+ prefix = '-' if %w(tree blob raw commits).include?(resource_type.to_s)
uri.path = [
relative_url_root,
project.full_path,
- uri_type(file_path),
+ prefix,
+ resource_type,
Addressable::URI.escape(ref).gsub('#', '%23'),
Addressable::URI.escape(file_path)
].compact.join('/').squeeze('/').chomp('/')