Skip to content

Commit c56b49b

Browse files
authored
router: Remove obsolete DefaultBodyLimit override (#10197)
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.
1 parent 684edc0 commit c56b49b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/router.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use axum::extract::DefaultBodyLimit;
21
use axum::response::IntoResponse;
32
use axum::routing::{delete, get, post, put};
43
use axum::{Json, Router};
@@ -12,8 +11,6 @@ use crate::openapi::BaseOpenApi;
1211
use crate::util::errors::not_found;
1312
use crate::Env;
1413

15-
const MAX_PUBLISH_CONTENT_LENGTH: usize = 128 * 1024 * 1024; // 128 MB
16-
1714
pub fn build_axum_router(state: AppState) -> Router<()> {
1815
let (router, openapi) = BaseOpenApi::router()
1916
.routes(routes!(
@@ -26,9 +23,7 @@ pub fn build_axum_router(state: AppState) -> Router<()> {
2623
// Routes used by `cargo`
2724
.route(
2825
"/api/v1/crates/new",
29-
put(krate::publish::publish)
30-
.layer(DefaultBodyLimit::max(MAX_PUBLISH_CONTENT_LENGTH))
31-
.get(krate::metadata::show_new),
26+
put(krate::publish::publish).get(krate::metadata::show_new),
3227
)
3328
.route(
3429
"/api/v1/crates/:crate_id/owners",

0 commit comments

Comments
 (0)