From eaacfbb91198bcf5d14e25fa64b3515f889e0d75 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Wed, 1 May 2024 13:17:14 +0300 Subject: [PATCH 1/1] Restore constraints on note id parameter --- config/routes.rb | 2 +- test/controllers/notes_controller_test.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index d1e4c74ae..8271e7e4d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -122,7 +122,7 @@ OpenStreetMap::Application.routes.draw do match :subscribe, :unsubscribe, :on => :member, :via => [:get, :post] end get "/changeset/:id/comments/feed" => "changeset_comments#index", :as => :changeset_comments_feed, :id => /\d*/, :defaults => { :format => "rss" } - resources :notes, :path => "note", :only => [:show, :new] + resources :notes, :path => "note", :id => /\d+/, :only => [:show, :new] get "/user/:display_name/history" => "changesets#index" get "/user/:display_name/history/feed" => "changesets#feed", :defaults => { :format => :atom } diff --git a/test/controllers/notes_controller_test.rb b/test/controllers/notes_controller_test.rb index e68a5f33b..ff1071897 100644 --- a/test/controllers/notes_controller_test.rb +++ b/test/controllers/notes_controller_test.rb @@ -179,9 +179,9 @@ class NotesControllerTest < ActionDispatch::IntegrationTest get path_method.call end - # assert_raise ActionController::UrlGenerationError do - # get path_method.call(:id => -10) # we won't have an id that's negative - # end + assert_raise ActionController::UrlGenerationError do + get path_method.call(:id => -10) # we won't have an id that's negative + end get path_method.call(:id => 0) assert_response :not_found -- 2.39.5