oops
This commit is contained in:
parent
92e2dd410f
commit
6f12373923
2 changed files with 6 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
use axum::{
|
||||
extract::DefaultBodyLimit,
|
||||
routing::{delete, get, post},
|
||||
Router, Server,
|
||||
};
|
||||
|
@ -41,6 +42,7 @@ async fn main() -> anyhow::Result<()> {
|
|||
.route("/i/:id", delete(routes::delete))
|
||||
.route("/api/upload", post(routes::upload))
|
||||
.route("/api/new_key", post(routes::new_key))
|
||||
.layer(DefaultBodyLimit::max(1_000_000_000))
|
||||
.with_state(Arc::clone(&state));
|
||||
|
||||
let addr: SocketAddr = format!("0.0.0.0:{}", port).parse()?;
|
||||
|
|
|
@ -21,12 +21,10 @@ pub async fn post(
|
|||
let mut file = None;
|
||||
|
||||
while let Some(field) = multipart.next_field().await.unwrap() {
|
||||
file = Some(
|
||||
field
|
||||
.bytes()
|
||||
.await
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?,
|
||||
);
|
||||
let bytes = field.bytes().await;
|
||||
if bytes.is_ok() {
|
||||
file = Some(bytes.unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
if file.is_none() {
|
||||
|
|
Loading…
Reference in a new issue