I'm using a form to post data to a rails controller. The data sent is a excel file's binary data and the controller should echo it back for the browser to trigger a download. (I must do it this way).
The issue is that I get a warning in Chrome:
Resource interpreted as Document but transferred with MIME type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: "http://192.168.2.39:3000/resources/export"
What I see as strange is that Rails shows "Rendered text template" at the end of the request.
Here is the controller action:
def export
begin
cookies.delete(:download_token)
cookies[:download_token] = params[:download_token]
send_data Base64.decode64(params[:data]), :filename => 'Tasks.xls', :type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8; header=present', :disposition => 'attachment'
rescue Exception => e
render nothing: true
end
end
And this is the end of the output of the export action:
"application/x-www-form-urlencoded"
Rendered text template (0.0ms)
Sent data Tasks.xls (1.2ms)
Completed 200 OK in 5006ms (Views: 0.9ms | ActiveRecord: 0.0ms)
I'm using Rails 4.
The request comes from form which targets an iframe in a EXT js 4 app.
The whole app has some html views and some views which use ext js.
I am using the turbolinks gem for the html views.
The file is actually sent and the browser triggers the download. Its just the warning I want to get rid of.
Update
I disabled turbolinks and the warning is still there.