diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-12-29 21:58:16 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-12-30 15:36:59 -0500 |
commit | d9d2e8a3e8de62beff685457e4e305f93122b206 (patch) | |
tree | 932bf5d30f725365df1f00e02df5a25434485201 /lib | |
parent | 4ed369558e5642ec69c160be5658bb3c6a495bbd (diff) | |
download | gitlab-ce-d9d2e8a3e8de62beff685457e4e305f93122b206.tar.gz |
Support a single directory traversal in RelativeLinkFilterrs-relative-links-to-root
Prior, if we were viewing a blob at
`https://example.com/namespace/project/blob/master/doc/some-file.md` and
it contained a relative link such as `[README](../README.md)`, the
resulting link when viewing the blob would be:
`https://example.com/namespace/project/blob/README.md` which omits the
`master` ref, resulting in a 404.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/filter/relative_link_filter.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb index 5a081125f21..66f166939e4 100644 --- a/lib/banzai/filter/relative_link_filter.rb +++ b/lib/banzai/filter/relative_link_filter.rb @@ -91,7 +91,7 @@ module Banzai parts = request_path.split('/') parts.pop if path_type(request_path) != 'tree' - while parts.length > 1 && path.start_with?('../') + while path.start_with?('../') parts.pop path.sub!('../', '') end |