Commit 43f0bca6 authored by Ahmad Sherif's avatar Ahmad Sherif

Avoid using Rugged in Gitlab::Git::Wiki#preview_slug

parent b3ba3996
...@@ -8,6 +8,7 @@ module Gitlab ...@@ -8,6 +8,7 @@ module Gitlab
{ name: name, email: email, message: message } { name: name, email: email, message: message }
end end
end end
PageBlob = Struct.new(:name)
def self.default_ref def self.default_ref
'master' 'master'
...@@ -80,7 +81,15 @@ module Gitlab ...@@ -80,7 +81,15 @@ module Gitlab
end end
def preview_slug(title, format) 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 end
private 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