1
0

Add dependencies to search (#578)

* Add dependencies to search

* add attrs for faceting

* run prepare

* Add user data route from token

* update to 24hrs

* Fix report bugs
This commit is contained in:
Geometrically
2023-04-20 16:38:30 -07:00
committed by GitHub
parent 5c559af936
commit 59f24df294
65 changed files with 1518 additions and 2218 deletions

View File

@@ -1,8 +1,6 @@
use crate::models::pack::{PackFileHash, PackFormat};
use crate::util::validate::validation_errors_to_string;
use crate::validate::{
SupportedGameVersions, ValidationError, ValidationResult,
};
use crate::validate::{SupportedGameVersions, ValidationError, ValidationResult};
use std::io::{Cursor, Read};
use std::path::Component;
use validator::Validate;
@@ -32,14 +30,11 @@ impl super::Validator for ModpackValidator {
archive: &mut ZipArchive<Cursor<bytes::Bytes>>,
) -> Result<ValidationResult, ValidationError> {
let pack: PackFormat = {
let mut file =
if let Ok(file) = archive.by_name("modrinth.index.json") {
file
} else {
return Ok(ValidationResult::Warning(
"Pack manifest is missing.",
));
};
let mut file = if let Ok(file) = archive.by_name("modrinth.index.json") {
file
} else {
return Ok(ValidationResult::Warning("Pack manifest is missing."));
};
let mut contents = String::new();
file.read_to_string(&mut contents)?;
@@ -48,9 +43,7 @@ impl super::Validator for ModpackValidator {
};
pack.validate().map_err(|err| {
ValidationError::InvalidInput(
validation_errors_to_string(err, None).into(),
)
ValidationError::InvalidInput(validation_errors_to_string(err, None).into())
})?;
if pack.game != "minecraft" {
@@ -75,11 +68,7 @@ impl super::Validator for ModpackValidator {
let path = std::path::Path::new(&file.path)
.components()
.next()
.ok_or_else(|| {
ValidationError::InvalidInput(
"Invalid pack file path!".into(),
)
})?;
.ok_or_else(|| ValidationError::InvalidInput("Invalid pack file path!".into()))?;
match path {
Component::CurDir | Component::Normal(_) => {}