From d8263dcdee13b27ea4ac56c28d10dc2ca7fb8b40 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Fri, 18 Feb 2022 08:03:52 +0000 Subject: Return 404 if revision URL doesn't exist (#36561). Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@21413 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/wiki_controller.rb | 2 +- app/models/wiki_page.rb | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 98066a713..074031eec 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -89,7 +89,7 @@ class WikiController < ApplicationController end @content = @page.content_for_version(params[:version]) if @content.nil? - if User.current.allowed_to?(:edit_wiki_pages, @project) && editable? && !api_request? + if params[:version].blank? && User.current.allowed_to?(:edit_wiki_pages, @project) && editable? && !api_request? edit render :action => 'edit' else diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index ff1c598eb..7c5693ca1 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -162,11 +162,7 @@ class WikiPage < ActiveRecord::Base end def content_for_version(version=nil) - if content - result = content.versions.find_by_version(version.to_i) if version - result ||= content - result - end + (content && version) ? content.versions.find_by_version(version.to_i) : content end def diff(version_to=nil, version_from=nil) -- cgit v1.2.3