aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-04-16 12:03:53 +0100
committerMark Longair <mhl@pobox.com>2013-04-16 12:52:09 +0100
commit5022558d56058bb723b4e29d1f0e455472960cda (patch)
tree5d808123b0509840296739204311c77467a60475
parentb920cb2a151236ea0b1340eae024e25729da234b (diff)
Fix attachment downloading for attachments that have file extensions
Fixes #912 The routing in Rails 3 by default extracts anything that looks like a file extension at the end of the URL and adds it as a format parameter. This meant that for the get_attachment and get_attachment_as_html views, the filename parameter would not include the file extension, and you'll end up with the error: please use same filename as original file has, display: 'foo.doc' old_display: 'foo.doc' original: 'foo' For particular routes, we can suppress this with :format => false so this commit adds that to both get_attachment and get_attachment_as_html.
-rw-r--r--config/routes.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/config/routes.rb b/config/routes.rb
index 10f6a3284..40cec32c8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -51,8 +51,8 @@ Alaveteli::Application.routes.draw do
match '/request/:url_title/describe/:described_state' => 'request#describe_state_message', :as => :describe_state_message
match '/request/:id/response' => 'request#show_response', :as => :show_response_no_followup
match '/request/:id/response/:incoming_message_id' => 'request#show_response', :as => :show_response
- match '/request/:id/response/:incoming_message_id/attach/html/:part/*file_name' => 'request#get_attachment_as_html', :as => :get_attachment_as_html
- match '/request/:id/response/:incoming_message_id/attach/:part(/*file_name)' => 'request#get_attachment', :as => :get_attachment
+ match '/request/:id/response/:incoming_message_id/attach/html/:part/*file_name' => 'request#get_attachment_as_html', :format => false, :as => :get_attachment_as_html
+ match '/request/:id/response/:incoming_message_id/attach/:part(/*file_name)' => 'request#get_attachment', :format => false, :as => :get_attachment
match '/request_event/:info_request_event_id' => 'request#show_request_event', :as => :info_request_event