diff options
Diffstat (limited to 'lib/banzai/filter/relative_link_filter.rb')
-rw-r--r-- | lib/banzai/filter/relative_link_filter.rb | 9 |
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('/') |