Fix gallery creation validation and validators returning incorrect er… (#263)

* Fix gallery creation validation and validators returning incorrect errors

* Remove docker image

* Add URL validation for pack files

* Remove unneeded dependencies
This commit is contained in:
Geometrically
2021-11-30 20:07:23 -07:00
committed by GitHub
parent 6740124364
commit a54b2db81b
11 changed files with 444 additions and 667 deletions

View File

@@ -67,7 +67,7 @@ pub async fn validate_file(
game_versions: Vec<GameVersion>,
all_game_versions: Vec<crate::database::models::categories::GameVersion>,
) -> Result<ValidationResult, ValidationError> {
Ok(actix_web::web::block(move || {
let res = actix_web::web::block(move || {
let reader = std::io::Cursor::new(data);
let mut zip = zip::ZipArchive::new(reader)?;
@@ -103,8 +103,15 @@ pub async fn validate_file(
Ok(ValidationResult::Pass)
}
})
.await
.map_err(|_| ValidationError::BlockingError)?)
.await;
match res {
Ok(x) => Ok(x),
Err(err) => match err {
actix_web::error::BlockingError::Canceled => Err(ValidationError::BlockingError),
actix_web::error::BlockingError::Error(err) => Err(err),
},
}
}
fn game_version_supported(