From 8eb5f2c6059cf4b707e616d8e5b9b9e6ce191172 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Wed, 15 May 2019 13:21:35 +0000 Subject: Do not lose submitted content when attempting to update a wiki page that has been renamed in the meantime (#31334). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@18165 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/wiki_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 995a40cc4..ae2447763 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -34,7 +34,7 @@ class WikiController < ApplicationController default_search_scope :wiki_pages before_action :find_wiki, :authorize - before_action :find_existing_or_new_page, :only => [:show, :edit, :update] + before_action :find_existing_or_new_page, :only => [:show, :edit] before_action :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy, :destroy_version] before_action :find_attachments, :only => [:preview] accept_api_auth :index, :show, :update, :destroy @@ -152,6 +152,8 @@ class WikiController < ApplicationController # Creates a new page or updates an existing one def update + @page = @wiki.find_or_new_page(params[:id]) + return render_403 unless editable? was_new_page = @page.new_record? @page.safe_attributes = params[:wiki_page] -- cgit v1.2.3