Skip to content

Commit

Permalink
router: Remove obsolete DefaultBodyLimit override (#10197)
Browse files Browse the repository at this point in the history
Now that we are not using the `BytesRequest` in the publish endpoint, this limit isn't actually used anymore. The `StreamReader` does not care about the limit and the JSON metadata blob and the tarball have their dedicated limits already.
  • Loading branch information
Turbo87 authored Dec 13, 2024
1 parent 684edc0 commit c56b49b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/router.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use axum::extract::DefaultBodyLimit;
use axum::response::IntoResponse;
use axum::routing::{delete, get, post, put};
use axum::{Json, Router};
Expand All @@ -12,8 +11,6 @@ use crate::openapi::BaseOpenApi;
use crate::util::errors::not_found;
use crate::Env;

const MAX_PUBLISH_CONTENT_LENGTH: usize = 128 * 1024 * 1024; // 128 MB

pub fn build_axum_router(state: AppState) -> Router<()> {
let (router, openapi) = BaseOpenApi::router()
.routes(routes!(
Expand All @@ -26,9 +23,7 @@ pub fn build_axum_router(state: AppState) -> Router<()> {
// Routes used by `cargo`
.route(
"/api/v1/crates/new",
put(krate::publish::publish)
.layer(DefaultBodyLimit::max(MAX_PUBLISH_CONTENT_LENGTH))
.get(krate::metadata::show_new),
put(krate::publish::publish).get(krate::metadata::show_new),
)
.route(
"/api/v1/crates/:crate_id/owners",
Expand Down

0 comments on commit c56b49b

Please sign in to comment.