提交 40da543f 编写于 作者: W winniehell

Add support for relative links starting with ./ or / to RelativeLinkFilter (!5586)

上级 701e5ccb
......@@ -4,6 +4,7 @@ v 8.11.0 (unreleased)
- Fix the title of the toggle dropdown button. !5515 (herminiotorres)
- Improve diff performance by eliminating redundant checks for text blobs
- Remove magic comments (`# encoding: UTF-8`) from Ruby files. !5456 (winniehell)
- Add support for relative links starting with ./ or / to RelativeLinkFilter (winniehell)
- Fix CI status icon link underline (ClemMakesApps)
- Cache the commit author in RequestStore to avoid extra lookups in PostReceive
- Fix of 'Commits being passed to custom hooks are already reachable when using the UI'
......
......@@ -87,10 +87,13 @@ module Banzai
def build_relative_path(path, request_path)
return request_path if path.empty?
return path unless request_path
return path[1..-1] if path.start_with?('/')
parts = request_path.split('/')
parts.pop if uri_type(request_path) != :tree
path.sub!(%r{^\./}, '')
while path.start_with?('../')
parts.pop
path.sub!('../', '')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册