Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/routes/maven.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,11 @@ pub async fn version_file(
return Err(ApiError::NotFound);
}

if file == format!("{}-{}.pom", &project_id, &vnum) {
if let Some(selected_file) = find_file(&project_id, &vnum, &version, &file) {
return Ok(HttpResponse::TemporaryRedirect()
.append_header(("location", &*selected_file.url))
.body(""));
} else if file == format!("{}-{}.pom", &project_id, &vnum) {
let respdata = MavenPom {
schema_location:
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
Expand All @@ -314,10 +318,6 @@ pub async fn version_file(
return Ok(HttpResponse::Ok()
.content_type("text/xml")
.body(yaserde::ser::to_string(&respdata).map_err(ApiError::Xml)?));
} else if let Some(selected_file) = find_file(&project_id, &vnum, &version, &file) {
return Ok(HttpResponse::TemporaryRedirect()
.append_header(("location", &*selected_file.url))
.body(""));
}

Err(ApiError::NotFound)
Expand Down
1 change: 1 addition & 0 deletions src/util/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn project_file_type(ext: &str) -> Option<&str> {
"jar" => Some("application/java-archive"),
"zip" | "litemod" => Some("application/zip"),
"mrpack" => Some("application/x-modrinth-modpack+zip"),
"pom" => Some("text/xml"),
_ => None,
}
}
2 changes: 1 addition & 1 deletion src/validate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub trait Validator: Sync {
) -> Result<ValidationResult, ValidationError>;
}

static ALWAYS_ALLOWED_EXT: &[&str] = &["zip", "txt"];
static ALWAYS_ALLOWED_EXT: &[&str] = &["zip", "txt", "pom"];

static VALIDATORS: &[&dyn Validator] = &[
&ModpackValidator,
Expand Down