mirror of
https://github.com/tokio-rs/axum.git
synced 2025-09-30 22:41:03 +00:00
Fix comment typos in stream-to-file example (#1200)
This commit is contained in:
parent
d7f2c140bc
commit
6ff1c2111e
@ -29,7 +29,7 @@ async fn main() {
|
|||||||
.with(tracing_subscriber::fmt::layer())
|
.with(tracing_subscriber::fmt::layer())
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
// save files to a separte directory to not override files in the current directory
|
// save files to a separate directory to not override files in the current directory
|
||||||
tokio::fs::create_dir(UPLOADS_DIRECTORY)
|
tokio::fs::create_dir(UPLOADS_DIRECTORY)
|
||||||
.await
|
.await
|
||||||
.expect("failed to create `uploads` directory");
|
.expect("failed to create `uploads` directory");
|
||||||
@ -128,7 +128,7 @@ where
|
|||||||
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))
|
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// to prevent directory traversal attacks we ensure the path conists of exactly one normal
|
// to prevent directory traversal attacks we ensure the path consists of exactly one normal
|
||||||
// component
|
// component
|
||||||
fn path_is_valid(path: &str) -> bool {
|
fn path_is_valid(path: &str) -> bool {
|
||||||
let path = std::path::Path::new(&*path);
|
let path = std::path::Path::new(&*path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user