mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-03 18:10:48 +00:00
fix: fix critical bug in zip/letter data guard preventing correct behaviour
This commit is contained in:
parent
78d77cd735
commit
32023f14a4
2 changed files with 2 additions and 6 deletions
|
|
@ -16,9 +16,7 @@ impl<'r> FromData<'r> for Letter {
|
||||||
type Error = Option<String>;
|
type Error = Option<String>;
|
||||||
|
|
||||||
async fn from_data(req: &'r Request<'_>, data: Data<'r>) -> data::Outcome<'r, Self> {
|
async fn from_data(req: &'r Request<'_>, data: Data<'r>) -> data::Outcome<'r, Self> {
|
||||||
let content_type_pdf = ContentType::new("application", "application/pdf");
|
if req.content_type() != Some(&ContentType::PDF) {
|
||||||
|
|
||||||
if req.content_type() != Some(&content_type_pdf) {
|
|
||||||
return Outcome::Failure((Status::BadRequest, None))
|
return Outcome::Failure((Status::BadRequest, None))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,7 @@ impl<'r> FromData<'r> for Portfolio {
|
||||||
type Error = Option<String>;
|
type Error = Option<String>;
|
||||||
|
|
||||||
async fn from_data(req: &'r Request<'_>, data: Data<'r>) -> data::Outcome<'r, Self> {
|
async fn from_data(req: &'r Request<'_>, data: Data<'r>) -> data::Outcome<'r, Self> {
|
||||||
let content_type_zip = ContentType::new("application", "application/zip");
|
if req.content_type() != Some(&ContentType::ZIP) {
|
||||||
|
|
||||||
if req.content_type() != Some(&content_type_zip) {
|
|
||||||
return Outcome::Failure((Status::BadRequest, None))
|
return Outcome::Failure((Status::BadRequest, None))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue