1
0
mirror of https://github.com/actix/examples synced 2024-11-23 14:31:07 +01:00

chore: update actix-multipart to v0.7

This commit is contained in:
Rob Ede 2024-07-07 00:59:16 +01:00
parent a67c7803e6
commit 8baa0767a6
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
5 changed files with 15 additions and 15 deletions

17
Cargo.lock generated
View File

@ -244,14 +244,13 @@ dependencies = [
[[package]]
name = "actix-multipart"
version = "0.6.2"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d974dd6c4f78d102d057c672dcf6faa618fafa9df91d44f9c466688fc1275a3a"
checksum = "d5118a26dee7e34e894f7e85aa0ee5080ae4c18bf03c0e30d49a80e418f00a53"
dependencies = [
"actix-multipart-derive",
"actix-utils",
"actix-web",
"bytes 1.6.0",
"derive_more",
"futures-core",
"futures-util",
@ -270,9 +269,9 @@ dependencies = [
[[package]]
name = "actix-multipart-derive"
version = "0.6.1"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a0a77f836d869f700e5b47ac7c3c8b9c8bc82e4aec861954c6198abee3ebd4d"
checksum = "e11eb847f49a700678ea2fa73daeb3208061afa2b9d1a8527c03390f4c4a1c6b"
dependencies = [
"darling 0.20.3",
"parse-size",
@ -1748,7 +1747,7 @@ dependencies = [
"bitflags 2.4.1",
"cexpr",
"clang-sys",
"itertools 0.12.1",
"itertools 0.11.0",
"lazy_static",
"lazycell",
"log",
@ -6164,7 +6163,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1"
dependencies = [
"anyhow",
"itertools 0.12.1",
"itertools 0.11.0",
"proc-macro2",
"quote",
"syn 2.0.48",
@ -8828,8 +8827,8 @@ version = "1.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675"
dependencies = [
"cfg-if 1.0.0",
"rand 0.8.5",
"cfg-if 0.1.10",
"rand 0.7.3",
"static_assertions",
]

View File

@ -83,8 +83,7 @@ actix-cors = "0.7"
actix-files = "0.6"
actix-http = "3.5"
actix-identity = "0.7"
actix-multipart = "0.6"
actix-multipart-derive = "0.6"
actix-multipart = "0.7"
actix-protobuf = "0.10"
actix-session = "0.9"
actix-test = "0.1"

View File

@ -74,7 +74,9 @@ async fn save_file_manual(mut payload: Multipart) -> Result<HttpResponse, Error>
// iterate over multipart stream
while let Some(mut field) = payload.try_next().await? {
// A multipart/form-data stream has to contain `content_disposition`
let content_disposition = field.content_disposition();
let Some(content_disposition) = field.content_disposition() else {
continue;
};
let filename = content_disposition
.get_filename()

View File

@ -61,7 +61,7 @@ async fn index(
},
)
} else {
tmpl_env.render("index.html", ())
tmpl_env.render("index.html", minijinja::Value::UNDEFINED)
}
}

View File

@ -15,7 +15,7 @@ async fn index(
tmpl: web::Data<tera::Tera>,
query: web::Query<HashMap<String, String>>,
) -> Result<impl Responder, Error> {
let s = if let Some(name) = query.get("name") {
let html = if let Some(name) = query.get("name") {
// submitted form
let mut ctx = tera::Context::new();
ctx.insert("name", name);
@ -27,7 +27,7 @@ async fn index(
.map_err(|_| error::ErrorInternalServerError("Template error"))?
};
Ok(web::Html::new(s))
Ok(web::Html::new(html))
}
#[actix_web::main]