summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-05-15 13:21:35 +0000
committerGo MAEDA <maeda@farend.jp>2019-05-15 13:21:35 +0000
commit8eb5f2c6059cf4b707e616d8e5b9b9e6ce191172 (patch)
tree00e4574455ccc678ed31d6d1cad310265f0ad242 /app/controllers
parentf1d10edf8157cdddbae29880a744ee7359046acc (diff)
downloadredmine-8eb5f2c6059cf4b707e616d8e5b9b9e6ce191172.tar.gz
redmine-8eb5f2c6059cf4b707e616d8e5b9b9e6ce191172.zip
Do not lose submitted content when attempting to update a wiki page that has been renamed in the meantime (#31334).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@18165 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/wiki_controller.rb4
1 files changed, 3 insertions, 1 deletions
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]