From 9ee0bbb895b841168f7987afe1a13660737b5ae7 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 11 May 2012 11:21:41 +0200 Subject: [PATCH] Improved content type detection. --- app/controllers/ticket_overviews_controller.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/ticket_overviews_controller.rb b/app/controllers/ticket_overviews_controller.rb index 9883155be..8029cb377 100644 --- a/app/controllers/ticket_overviews_controller.rb +++ b/app/controllers/ticket_overviews_controller.rb @@ -4,7 +4,7 @@ class TicketOverviewsController < ApplicationController # GET /tickets # GET /tickets.json def show - +#sleep 2 # build up attributes hash overview_selected = nil overview_selected_raw = nil @@ -246,9 +246,15 @@ class TicketOverviewsController < ApplicationController # puts params.inspect # store file - content_type = request.content_type - if content_type == 'application/octet-stream' - content_type = MIME::Types.type_for(params[:qqfile]).first.content_type +# content_type = request.content_type + content_type = request[:content_type] + puts 'content_type: ' + content_type.inspect + if !content_type || content_type == 'application/octet-stream' + if MIME::Types.type_for(params[:qqfile]).first + content_type = MIME::Types.type_for(params[:qqfile]).first.content_type + else + content_type = 'application/octet-stream' + end end headers_store = { 'Content-Type' => content_type