fix: fix critical bug in zip/letter data guard preventing correct behaviour

This commit is contained in:
EETagent 2022-11-07 20:26:02 +01:00
parent 78d77cd735
commit 32023f14a4
2 changed files with 2 additions and 6 deletions

View file

@ -16,9 +16,7 @@ impl<'r> FromData<'r> for Letter {
type Error = Option<String>;
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(&content_type_pdf) {
if req.content_type() != Some(&ContentType::PDF) {
return Outcome::Failure((Status::BadRequest, None))
}

View file

@ -16,9 +16,7 @@ impl<'r> FromData<'r> for Portfolio {
type Error = Option<String>;
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(&content_type_zip) {
if req.content_type() != Some(&ContentType::ZIP) {
return Outcome::Failure((Status::BadRequest, None))
}