summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorGabriel Mazetto <gabriel@gitlab.com>2016-04-01 05:22:22 -0300
committerGabriel Mazetto <gabriel@gitlab.com>2016-04-06 03:13:46 -0300
commit22055e10580ae93c2cb87956eefba0a06e9b50d0 (patch)
tree49691215a4fd7c001368f34277f0885ddb2915fa /lib/banzai
parent61fe0a23977749b0a5dba41ca26101b4a03de720 (diff)
downloadgitlab-ce-22055e10580ae93c2cb87956eefba0a06e9b50d0.tar.gz
Fix a few edited references from WikiLinkFilter and specs
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/wiki_link_filter.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/banzai/filter/wiki_link_filter.rb b/lib/banzai/filter/wiki_link_filter.rb
index 7a585eff653..06d10c98501 100644
--- a/lib/banzai/filter/wiki_link_filter.rb
+++ b/lib/banzai/filter/wiki_link_filter.rb
@@ -25,10 +25,10 @@ module Banzai
end
def process_link_attr(html_attr)
- return if html_attr.blank?
+ return if html_attr.blank? || file_reference?(html_attr)
uri = URI(html_attr.value)
- if uri.relative? && uri.path.present? && uri.path
+ if uri.relative? && uri.path.present?
html_attr.value = rebuild_wiki_uri(uri).to_s
end
rescue URI::Error
@@ -40,6 +40,10 @@ module Banzai
uri
end
+ def file_reference?(html_attr)
+ !File.extname(html_attr.value).blank?
+ end
+
def project_wiki
context[:project_wiki]
end