Description:
returns correct content type for task description download
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r273:0e765be64abb - - 1 file changed: 7 inserted, 1 deleted
@@ -28,13 +28,19 | |||||
|
28 | response.headers['Content-Type'] = "application/force-download" |
|
28 | response.headers['Content-Type'] = "application/force-download" |
|
29 | response.headers['Content-Disposition'] = "attachment; filename=\"#{File.basename(filename)}\"" |
|
29 | response.headers['Content-Disposition'] = "attachment; filename=\"#{File.basename(filename)}\"" |
|
30 | response.headers["X-Sendfile"] = filename |
|
30 | response.headers["X-Sendfile"] = filename |
|
31 | response.headers['Content-length'] = File.size(filename) |
|
31 | response.headers['Content-length'] = File.size(filename) |
|
32 | render :nothing => true |
|
32 | render :nothing => true |
|
33 | else |
|
33 | else |
|
34 | - send_file filename, :stream => false, :filename => base_filename |
|
34 | + if params[:ext]=='pdf' |
|
|
35 | + content_type = 'application/pdf' | ||
|
|
36 | + else | ||
|
|
37 | + content_type = 'application/octet-stream' | ||
|
|
38 | + end | ||
|
|
39 | + | ||
|
|
40 | + send_file filename, :stream => false, :filename => base_filename, :type => content_type | ||
|
35 | end |
|
41 | end |
|
36 | end |
|
42 | end |
|
37 |
|
43 | ||
|
38 | protected |
|
44 | protected |
|
39 |
|
45 | ||
|
40 | def check_viewability |
|
46 | def check_viewability |
You need to be logged in to leave comments.
Login now