Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Ephemeral
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Volkor Barbarian Warrior
Ephemeral
Commits
9547bd8d
Unverified
Commit
9547bd8d
authored
2 years ago
by
Volkor Barbarian Warrior
Browse files
Options
Downloads
Patches
Plain Diff
Replace rendering with just sending 200 OK
Fixes
#22
-
https://github.com/salvo-rs/salvo/issues/233
parent
7a61fef4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main.rs
+4
-4
4 additions, 4 deletions
src/main.rs
static/sharex.sxcu
+0
-9
0 additions, 9 deletions
static/sharex.sxcu
with
4 additions
and
13 deletions
src/main.rs
+
4
−
4
View file @
9547bd8d
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
static/sharex.sxcu
deleted
100644 → 0
+
0
−
9
View file @
7a61fef4
{
"Name": "cz0.au file uploader",
"DestinationType": "FileUploader",
"RequestURL": "https://cz0.au",
"FileFormName": "file",
"ResponseType": "Text",
"URL": "$json:url$",
"DeletionURL": "$json:deletionurl$"
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment