BigW Consortium Gitlab

Commit aee7f0d0 by Sean McGivern

Merge branch 'fix/avoid-using-rugged-in-wiki-preview-slug' into 'master'

Avoid using Rugged in Gitlab::Git::Wiki#preview_slug See merge request gitlab-org/gitlab-ce!15054
parents ab9b54f9 43f0bca6
......@@ -8,6 +8,7 @@ module Gitlab
{ name: name, email: email, message: message }
end
end
PageBlob = Struct.new(:name)
def self.default_ref
'master'
......@@ -80,7 +81,15 @@ module Gitlab
end
def preview_slug(title, format)
gollum_wiki.preview_page(title, '', format).url_path
# Adapted from gollum gem (Gollum::Wiki#preview_page) to avoid
# using Rugged through a Gollum::Wiki instance
page_class = Gollum::Page
page = page_class.new(nil)
ext = page_class.format_to_ext(format.to_sym)
name = page_class.cname(title) + '.' + ext
blob = PageBlob.new(name)
page.populate(blob)
page.url_path
end
private
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment