Skip to content
Snippets Groups Projects
Unverified Commit 9547bd8d authored by Volkor Barbarian Warrior's avatar Volkor Barbarian Warrior
Browse files

Replace rendering with just sending 200 OK

parent 7a61fef4
No related branches found
No related tags found
No related merge requests found
......@@ -166,7 +166,8 @@ async fn serve_file(req: &mut Request, res: &mut Response) {
// X-Accel-Redirect lets nginx serve the file directly, instead of us doing all that hard work.
let xsend = "/files/".to_string() + &filename.to_string();
res.add_header("X-Accel-Redirect", xsend, true).unwrap();
res.render("");
// https://github.com/salvo-rs/salvo/issues/233
res.set_status_code(StatusCode::OK);
} else {
// If nginx sendfile is disabled, we need to render the file directly
let filepath = "files/".to_string() + &filename.to_string();
......@@ -178,9 +179,8 @@ async fn serve_file(req: &mut Request, res: &mut Response) {
"content-type exists: content-type: {:?}",
res.headers().get("content-type").unwrap()
);
file.send(headers, res).await;
// This complains about us writing into ResBody::Stream, but it means it renders as plaintext, so who cares.
res.render("");
file.send(headers, res).await;
res.set_status_code(StatusCode::OK);
} else {
// Grab the content-type of the file
let contenttype = file.content_type().to_string();
......
{
"Name": "cz0.au file uploader",
"DestinationType": "FileUploader",
"RequestURL": "https://cz0.au",
"FileFormName": "file",
"ResponseType": "Text",
"URL": "$json:url$",
"DeletionURL": "$json:deletionurl$"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment