diff options
author | John Jarvis <jarv@gitlab.com> | 2019-09-02 14:00:39 +0000 |
---|---|---|
committer | John Jarvis <jarv@gitlab.com> | 2019-09-02 14:00:39 +0000 |
commit | cded55c0f100cf624720608119d1aa4f1f47b53a (patch) | |
tree | 2f56d22eab0a8d8a75f5d753767be1b7a1edb15e /lib/banzai/filter/relative_link_filter.rb | |
parent | 13598699b0a28c76627c49fd7a7afc6e1c06f775 (diff) | |
parent | 2e0a846e20c872fad6d47216662620866081253a (diff) | |
download | gitlab-ce-cded55c0f100cf624720608119d1aa4f1f47b53a.tar.gz |
Merge branch '12-2-stable-patch-4' into '12-2-stable'
Prepare 12.2.4 release
See merge request gitlab-org/gitlab-ce!32455
Diffstat (limited to 'lib/banzai/filter/relative_link_filter.rb')
-rw-r--r-- | lib/banzai/filter/relative_link_filter.rb | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb index 846a7d46aad..2b734db5cfb 100644 --- a/lib/banzai/filter/relative_link_filter.rb +++ b/lib/banzai/filter/relative_link_filter.rb @@ -19,7 +19,6 @@ module Banzai def call return doc if context[:system_note] - return doc unless visible_to_user? @uri_types = {} clear_memoization(:linkable_files) @@ -50,7 +49,7 @@ module Banzai if html_attr.value.start_with?('/uploads/') process_link_to_upload_attr(html_attr) - elsif linkable_files? + elsif linkable_files? && repo_visible_to_user? process_link_to_repository_attr(html_attr) end end @@ -168,14 +167,8 @@ module Banzai Gitlab.config.gitlab.relative_url_root.presence || '/' end - def visible_to_user? - if project - Ability.allowed?(current_user, :download_code, project) - elsif group - Ability.allowed?(current_user, :read_group, group) - else # Objects detached from projects or groups, e.g. Personal Snippets. - true - end + def repo_visible_to_user? + project && Ability.allowed?(current_user, :download_code, project) end def ref |