diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-08-08 10:14:21 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-08-08 10:14:21 +0200 |
commit | 8ae222092dc63d672dc505358d7bdfbb8478c774 (patch) | |
tree | 44082b65f583923ff48fd1315e0ccf44c2293b6e /lib/banzai/filter/relative_link_filter.rb | |
parent | 1b5e2303debf00784603d6bd9d87d613de3c8091 (diff) | |
parent | 91030230545a199a86c2742600a7a2e68ef75c98 (diff) | |
download | gitlab-ce-8ae222092dc63d672dc505358d7bdfbb8478c774.tar.gz |
Merge branch 'master' into feature/svg-badge-template
* master: (363 commits)
Added changelog item for issuable form dropdowns
Add 'run tests' docs from GDK
Bump gitlab_git to lazy load compare commits
Add examples to repository files API (!5465)
Ignore URLs starting with // (!5677)
Add failing test for #7032
Update timeago to shorter representation
Add missing DOWNTIME constant to the AddTimestampsToMembersAgain migration
Added guide about migrations and downtime
Update CHANGELOG for 8.10.4
Add a data migration to fix some missing timestamps in the members table (again)
Move abilities by subject class to a dedicated method
Remove unnecessary empty line after css var
Set consistency in list text height css
Add description to text/plain emails
Fix Rename `add_users_into_project` and `projects_ids`
fix spec
Underscore variable to camelCase
using shared path for project import uploads and refactored gitlab remove export worker
Structure the development documentation
...
Diffstat (limited to 'lib/banzai/filter/relative_link_filter.rb')
-rw-r--r-- | lib/banzai/filter/relative_link_filter.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb index 337fb50317d..46762d401fb 100644 --- a/lib/banzai/filter/relative_link_filter.rb +++ b/lib/banzai/filter/relative_link_filter.rb @@ -35,6 +35,7 @@ module Banzai def process_link_attr(html_attr) return if html_attr.blank? + return if html_attr.value.start_with?('//') uri = URI(html_attr.value) if uri.relative? && uri.path.present? @@ -87,10 +88,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{\A\./}, '') + while path.start_with?('../') parts.pop path.sub!('../', '') |