]> source.dussan.org Git - redmine.git/commitdiff
scm: fix diff revision param validation.
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 17 Feb 2011 14:17:04 +0000 (14:17 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 17 Feb 2011 14:17:04 +0000 (14:17 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4860 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/repositories_controller.rb
test/functional/repositories_subversion_controller_test.rb

index de44f1d08f6c6eb361ec9a19f176e7736d57b1ef..ecf90084997e38b9a1a755d5b21a2fbb27192727 100644 (file)
@@ -218,7 +218,7 @@ class RepositoriesController < ApplicationController
     @rev = params[:rev].blank? ? @repository.default_branch : params[:rev].strip
     @rev_to = params[:rev_to]
     
-    unless @rev.to_s.match(REV_PARAM_RE) && @rev.to_s.match(REV_PARAM_RE)
+    unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE)
       if @repository.branches.blank?
         raise InvalidRevisionParam
       end
index be2b6087d5b9c17d1f77d83f3c2a2149a73e6046..54cc4cd674b9006186b3323942cf5e4aaf43d49d 100644 (file)
@@ -172,6 +172,12 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
       assert_error_tag :content => /was not found/
     end
 
+    def test_invalid_revision_diff
+      get :diff, :id => 1, :rev => '1', :rev_to => 'something_weird'
+      assert_response 404
+      assert_error_tag :content => /was not found/
+    end
+
     def test_empty_revision
       ['', ' ', nil].each do |r|
         get :revision, :id => 1, :rev => r