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
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-10-27 16:28:20 +0300
committerSean McGivern <sean@mcgivern.me.uk>2017-10-27 16:28:20 +0300
commitaee7f0d0cb8cbf62abd9d86ebd2b28035b28c0fe (patch)
tree665e31bda74f0e37a6fc67080d92dd1390f7ab8c
parentab9b54f977b921267f7703f170216fb3594d00a5 (diff)
parent43f0bca64825ac6f2863c810f19bf78f919c5e61 (diff)
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
-rw-r--r--lib/gitlab/git/wiki.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/git/wiki.rb b/lib/gitlab/git/wiki.rb
index e7b2f52a552..f01d5c96fc8 100644
--- a/lib/gitlab/git/wiki.rb
+++ b/lib/gitlab/git/wiki.rb
@@ -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