diff options
author | Rémy Coutable <remy@rymai.me> | 2016-07-25 08:22:19 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-25 08:22:19 +0000 |
commit | 0030fe53818b7c3a56ce81fb05175879d0e47533 (patch) | |
tree | b7db01d7e3cb891d1626fd2ecb9ec199f2bb1cf0 /app | |
parent | 1b6de302bdf4af12cd54d85b8178df0d557641a9 (diff) | |
parent | 42a00f740b04555d9150f900145b4dd685000aaf (diff) | |
download | gitlab-ce-0030fe53818b7c3a56ce81fb05175879d0e47533.tar.gz |
Merge branch 'fix-wiki-error-500' into 'master'
Fix Error 500 when creating Wiki pages with hyphens or spaces
- Closes gitlab-com/support-forum#874
- Closes #20209
See merge request !5444
Diffstat (limited to 'app')
-rw-r--r-- | app/models/wiki_page.rb | 6 | ||||
-rw-r--r-- | app/views/layouts/project.html.haml | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 3d5fd9d3ee9..c3de278f5b7 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -44,7 +44,11 @@ class WikiPage # The escaped URL path of this page. def slug - @attributes[:slug] + if @attributes[:slug].present? + @attributes[:slug] + else + wiki.wiki.preview_page(title, '', format).url_path + end end alias_method :to_param, :slug diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index d03d5e2ca6a..ee9c0366f2b 100644 --- a/app/views/layouts/project.html.haml +++ b/app/views/layouts/project.html.haml @@ -6,7 +6,7 @@ - content_for :scripts_body_top do - project = @target_project || @project - if @project_wiki && @page - - markdown_preview_path = namespace_project_wiki_markdown_preview_path(project.namespace, project, @page.title) + - markdown_preview_path = namespace_project_wiki_markdown_preview_path(project.namespace, project, @page.slug) - else - markdown_preview_path = markdown_preview_namespace_project_path(project.namespace, project) - if current_user |