From 2ba5e6259e14f9bc9f60201da249a5a313bbd0db Mon Sep 17 00:00:00 2001 From: Timothy Andrew Date: Thu, 21 Jul 2016 17:46:33 +0530 Subject: [PATCH] Don't use `params[:id]` while building `markdown_preview_path`. 1. Instead, use `@page.title`, since it's always guaranteed to be around in a wiki. 2. `params[:id]` is _not_ always guaranteed to be around - if a page is created with errors, `render :edit` is called, and `params[:id]` is `nil`. 3. More context: https://gitlab.com/gitlab-org/gitlab-ce/issues/20079#note_13223240 --- app/views/layouts/project.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml index 2049b204956..d03d5e2ca6a 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, params[:id]) + - markdown_preview_path = namespace_project_wiki_markdown_preview_path(project.namespace, project, @page.title) - else - markdown_preview_path = markdown_preview_namespace_project_path(project.namespace, project) - if current_user