Commit c9c14584 authored by Douwe Maan's avatar Douwe Maan

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 aac65984.

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
parents f83a596d 8acad49f
...@@ -10,6 +10,7 @@ v 8.6.0 (unreleased) ...@@ -10,6 +10,7 @@ v 8.6.0 (unreleased)
setup. A password can be provided during setup (see installation docs), or setup. A password can be provided during setup (see installation docs), or
GitLab will ask the user to create a new one upon first visit. GitLab will ask the user to create a new one upon first visit.
- Fix issue when pushing to projects ending in .wiki - Fix issue when pushing to projects ending in .wiki
- Add support for wiki with UTF-8 page names (Hiroyuki Sato)
- Don't load all of GitLab in mail_room - Don't load all of GitLab in mail_room
- Update `omniauth-saml` to 1.5.0 to allow for custom response attributes to be set - Update `omniauth-saml` to 1.5.0 to allow for custom response attributes to be set
- Memoize @group in Admin::GroupsController (Yatish Mehta) - Memoize @group in Admin::GroupsController (Yatish Mehta)
......
...@@ -58,7 +58,9 @@ gem "gitlab_git", '~> 9.0' ...@@ -58,7 +58,9 @@ gem "gitlab_git", '~> 9.0'
gem 'gitlab_omniauth-ldap', '~> 1.2.1', require: "omniauth-ldap" gem 'gitlab_omniauth-ldap', '~> 1.2.1', require: "omniauth-ldap"
# Git Wiki # Git Wiki
gem 'gollum-lib', '~> 4.1.0' # Required manually in config/initializers/gollum.rb to control load order
gem 'gollum-lib', '~> 4.1.0', require: false
gem 'gollum-rugged_adapter', '~> 0.4.2', require: false
# Language detection # Language detection
gem "github-linguist", "~> 4.7.0", require: "linguist" gem "github-linguist", "~> 4.7.0", require: "linguist"
......
...@@ -381,6 +381,9 @@ GEM ...@@ -381,6 +381,9 @@ GEM
rouge (~> 1.9) rouge (~> 1.9)
sanitize (~> 2.1.0) sanitize (~> 2.1.0)
stringex (~> 2.5.1) stringex (~> 2.5.1)
gollum-rugged_adapter (0.4.2)
mime-types (>= 1.15)
rugged (~> 0.24.0, >= 0.21.3)
gon (6.0.1) gon (6.0.1)
actionpack (>= 3.0) actionpack (>= 3.0)
json json
...@@ -703,7 +706,7 @@ GEM ...@@ -703,7 +706,7 @@ GEM
rubyntlm (0.5.2) rubyntlm (0.5.2)
rubypants (0.2.0) rubypants (0.2.0)
rufus-scheduler (3.1.10) rufus-scheduler (3.1.10)
rugged (0.24.0b13) rugged (0.24.0)
safe_yaml (1.0.4) safe_yaml (1.0.4)
sanitize (2.1.0) sanitize (2.1.0)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
...@@ -941,6 +944,7 @@ DEPENDENCIES ...@@ -941,6 +944,7 @@ DEPENDENCIES
gitlab_meta (= 7.0) gitlab_meta (= 7.0)
gitlab_omniauth-ldap (~> 1.2.1) gitlab_omniauth-ldap (~> 1.2.1)
gollum-lib (~> 4.1.0) gollum-lib (~> 4.1.0)
gollum-rugged_adapter (~> 0.4.2)
gon (~> 6.0.1) gon (~> 6.0.1)
grape (~> 0.13.0) grape (~> 0.13.0)
grape-entity (~> 0.4.2) grape-entity (~> 0.4.2)
......
...@@ -2,7 +2,7 @@ class ProjectWiki ...@@ -2,7 +2,7 @@ class ProjectWiki
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
MARKUPS = { MARKUPS = {
'Markdown' => :md, 'Markdown' => :markdown,
'RDoc' => :rdoc, 'RDoc' => :rdoc,
'AsciiDoc' => :asciidoc 'AsciiDoc' => :asciidoc
} unless defined?(MARKUPS) } unless defined?(MARKUPS)
...@@ -47,7 +47,7 @@ class ProjectWiki ...@@ -47,7 +47,7 @@ class ProjectWiki
def wiki def wiki
@wiki ||= begin @wiki ||= begin
Gollum::Wiki.new(path_to_repo) Gollum::Wiki.new(path_to_repo)
rescue Gollum::NoSuchPathError rescue Rugged::OSError
create_repo! create_repo!
end end
end end
...@@ -90,7 +90,7 @@ class ProjectWiki ...@@ -90,7 +90,7 @@ class ProjectWiki
def create_page(title, content, format = :markdown, message = nil) def create_page(title, content, format = :markdown, message = nil)
commit = commit_details(:created, message, title) 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 update_project_activity
rescue Gollum::DuplicatePageError => e rescue Gollum::DuplicatePageError => e
...@@ -101,7 +101,7 @@ class ProjectWiki ...@@ -101,7 +101,7 @@ class ProjectWiki
def update_page(page, content, format = :markdown, message = nil) def update_page(page, content, format = :markdown, message = nil)
commit = commit_details(:updated, message, page.title) 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 update_project_activity
end end
......
...@@ -62,7 +62,7 @@ class WikiPage ...@@ -62,7 +62,7 @@ class WikiPage
# The raw content of this page. # The raw content of this page.
def content def content
@attributes[:content] ||= if @page @attributes[:content] ||= if @page
@page.raw_data @page.text_data
end end
end end
......
module Gollum
GIT_ADAPTER = "rugged"
end
require "gollum-lib"
module Gollum
class Committer
# Patch for UTF-8 path
def method_missing(name, *args)
index.send(name, *args)
end
end
end
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