Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
0985868a
Commit
0985868a
authored
Oct 16, 2020
by
Robert Czechowski
Browse files
Set mimetype to text/csv for CSV downloads. Fixes
#115
parent
a34c58d6
Pipeline
#872
passed with stages
in 25 minutes and 35 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/webfw_iron.rs
View file @
0985868a
...
...
@@ -21,6 +21,7 @@ use iron::modifiers::Redirect;
use
iron
::
modifiers
::
RedirectRaw
;
use
iron
::
prelude
::
*
;
use
iron
::{
status
,
AfterMiddleware
,
AroundMiddleware
,
Handler
};
use
iron
::
mime
::
Mime
;
use
iron_sessionstorage
;
use
iron_sessionstorage
::
backends
::
SignedCookieBackend
;
use
iron_sessionstorage
::
traits
::
*
;
...
...
@@ -492,9 +493,10 @@ fn contestresults_download<C>(req: &mut Request) -> IronResult<Response>
// TODO: The name should be returned by core::show_contest_results directly
)]
};
let
mime
:
Mime
=
"text/csv"
.parse
()
.unwrap
();
let
mut
resp
=
Response
::
new
();
resp
.headers
.set
(
cd
);
resp
.set_mut
(
Template
::
new
(
&
format!
(
"{}_download"
,
template
),
data
))
.set_mut
(
status
::
Ok
);
resp
.set_mut
(
Template
::
new
(
&
format!
(
"{}_download"
,
template
),
data
))
.set_mut
(
status
::
Ok
)
.set_mut
(
mime
)
;
Ok
(
resp
)
}
...
...
@@ -739,9 +741,10 @@ fn group_download<C>(req: &mut Request) -> IronResult<Response>
// TODO: The name should be returned by core::show_group directly
)]
};
let
mime
:
Mime
=
"text/csv"
.parse
()
.unwrap
();
let
mut
resp
=
Response
::
new
();
resp
.headers
.set
(
cd
);
resp
.set_mut
(
Template
::
new
(
&
format!
(
"{}_download"
,
template
),
data
))
.set_mut
(
status
::
Ok
);
resp
.set_mut
(
Template
::
new
(
&
format!
(
"{}_download"
,
template
),
data
))
.set_mut
(
status
::
Ok
)
.set_mut
(
mime
)
;
Ok
(
resp
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment