summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/routes.rb8
-rw-r--r--test/functional/attachments_controller_test.rb11
2 files changed, 5 insertions, 14 deletions
diff --git a/config/routes.rb b/config/routes.rb
index fa65b4417..2a8e24c0a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -317,9 +317,11 @@ Rails.application.routes.draw do
get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
resources :attachments, :only => [:show, :update, :destroy]
- get 'attachments/:object_type/:object_id/edit', :to => 'attachments#edit_all', :as => :object_attachments_edit
- patch 'attachments/:object_type/:object_id', :to => 'attachments#update_all', :as => :object_attachments
- get 'attachments/:object_type/:object_id/download', :to => 'attachments#download_all', :as => :object_attachments_download
+ constraints object_type: /(issues|versions|news|messages|wiki_pages|projects|documents|journals)/ do
+ get 'attachments/:object_type/:object_id/edit', :to => 'attachments#edit_all', :as => :object_attachments_edit
+ patch 'attachments/:object_type/:object_id', :to => 'attachments#update_all', :as => :object_attachments
+ get 'attachments/:object_type/:object_id/download', :to => 'attachments#download_all', :as => :object_attachments_download
+ end
resources :groups do
resources :memberships, :controller => 'principal_memberships'
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index 71c54a774..4dbe3ce6e 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -491,17 +491,6 @@ class AttachmentsControllerTest < Redmine::ControllerTest
assert_select 'h2 a', :text => "Feature request #2"
end
- def test_edit_all_with_invalid_container_class_should_return_404
- get(
- :edit_all,
- :params => {
- :object_type => 'nuggets',
- :object_id => '3'
- }
- )
- assert_response 404
- end
-
def test_edit_all_with_invalid_object_should_return_404
get(
:edit_all,