Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-12 06:57:52 +0300
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-12 06:57:52 +0300
commitf29a7ce51f1f9d859258e190cf1d01c3d58806e1 (patch)
treed9c9fc124f0428d766d009c615f0ee823df9c081 /lib
parent85e3b25c04f33a73886d6294a54045b8e71c3545 (diff)
parent11e966d7a93ec0a745cde65021fa79a6a6b24667 (diff)
Merge branch 'markdown-smb-link' into 'master'
Allow smb:// links in Markdown text. As requested by Sam McLeod at https://gitlab.com/gitlab-org/gitlab-ce/issues/1184 See merge request !1669
Diffstat (limited to 'lib')
-rw-r--r--lib/redcarpet/render/gitlab_html.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb
index 713d7c39a11..1cd3933e4b7 100644
--- a/lib/redcarpet/render/gitlab_html.rb
+++ b/lib/redcarpet/render/gitlab_html.rb
@@ -11,6 +11,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
super options
end
+ def preprocess(full_document)
+ # Redcarpet doesn't allow SMB links when `safe_links_only` is enabled.
+ # FTP links are allowed, so we trick Redcarpet.
+ full_document.gsub("smb://", "ftp://smb:")
+ end
+
# If project has issue number 39, apostrophe will be linked in
# regular text to the issue as Redcarpet will convert apostrophe to
# #39;
@@ -55,6 +61,8 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
end
def postprocess(full_document)
+ full_document.gsub!("ftp://smb:", "smb://")
+
full_document.gsub!("&rsquo;", "'")
unless @template.instance_variable_get("@project_wiki") || @project.nil?
full_document = h.create_relative_links(full_document)