summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-03-16 01:21:34 +0000
committerDouwe Maan <douwe@gitlab.com>2016-03-16 01:21:34 +0000
commitc9c14584b79a389f6a558a9a0b20d1b7ded03407 (patch)
tree7467268a34d23aca40bfcf98e5d5613af621cdc3 /app/models
parentf83a596db3b58a5c4f4a1667c9e9c89d173e66e5 (diff)
parent8acad49fe0a492c2f4e16756135679b3a190543b (diff)
downloadgitlab-ce-c9c14584b79a389f6a558a9a0b20d1b7ded03407.tar.gz
Merge branch 'support-utf8-wiki-page-title' into 'master'
Support Wiki with UTF-8 page name ## What does this MR do? Support Wiki with UTF-8 page name. See https://github.com/gollum/gollum/pull/929 ## Why was this MR needed? Relax constraints for wiki slug in aac6598482036e12a20b4c75f2a508bd6a017245. It allows to create a wiki with UTF-8 name, but creating a wiki with UTF-8 name causes 500 error. Creating a wiki with UTF-8 name once, then creating or updating wiki with ascii name also cause 500 error i.e. no one can create and update any wiki pages in the project. ## Workaround 1. Go to `https://DOMAIN/repo/wikis/git_access` -> this page display the link to git clone 2. Clone the wiki repo 3. Find the page with UTF-8 name 4. Rename or Delete these files 5. Commit and push ## What are the relevant issue numbers? - #13979 - #13891 - #13698 - #13603 - #13317 - #12906 - #12825 - #10945 ## Todo - [x] Waiting for 'gollum-rugged_adapter' that support rugged v0.24.0 release 'gollum-rugged_adapter' gem doesn't allow to install rugged v0.24.0 (it's still beta version), but 'gitlab_git' gem depends on rugged v0.24.0b13. So it can't install both 'gollum-rugged_adapter' and 'gitlab_git' now. See merge request !2999
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project_wiki.rb8
-rw-r--r--app/models/wiki_page.rb2
2 files changed, 5 insertions, 5 deletions
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index c96e6f0b8ea..59b1b86d1fb 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -2,7 +2,7 @@ class ProjectWiki
include Gitlab::ShellAdapter
MARKUPS = {
- 'Markdown' => :md,
+ 'Markdown' => :markdown,
'RDoc' => :rdoc,
'AsciiDoc' => :asciidoc
} unless defined?(MARKUPS)
@@ -47,7 +47,7 @@ class ProjectWiki
def wiki
@wiki ||= begin
Gollum::Wiki.new(path_to_repo)
- rescue Gollum::NoSuchPathError
+ rescue Rugged::OSError
create_repo!
end
end
@@ -90,7 +90,7 @@ class ProjectWiki
def create_page(title, content, format = :markdown, message = nil)
commit = commit_details(:created, message, title)
- wiki.write_page(title, format, content, commit)
+ wiki.write_page(title, format.to_sym, content, commit)
update_project_activity
rescue Gollum::DuplicatePageError => e
@@ -101,7 +101,7 @@ class ProjectWiki
def update_page(page, content, format = :markdown, message = nil)
commit = commit_details(:updated, message, page.title)
- wiki.update_page(page, page.name, format, content, commit)
+ wiki.update_page(page, page.name, format.to_sym, content, commit)
update_project_activity
end
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index dbd70dc5a44..526760779a4 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -62,7 +62,7 @@ class WikiPage
# The raw content of this page.
def content
@attributes[:content] ||= if @page
- @page.raw_data
+ @page.text_data
end
end