Skip to content

Commit

Permalink
fix: lower upload limit for js builds (#1472)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->
Fixes RVT-4194
## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
MasterPtato committed Nov 26, 2024
1 parent 9757b15 commit 2ffc65b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/services/build/src/ops/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use chirp_workflow::prelude::*;
use rivet_operation::prelude::proto::backend;

const MAX_UPLOAD_SIZE: u64 = util::file_size::gigabytes(8);
const MAX_JS_BUILD_UPLOAD_SIZE: u64 = util::file_size::megabytes(10);
use crate::{
types::{upload::PrepareFile, upload::PresignedUploadRequest, BuildCompression, BuildKind},
utils,
Expand Down Expand Up @@ -86,8 +87,12 @@ pub async fn get(ctx: &OperationCtx, input: &Input) -> GlobalResult<Output> {
);
ensure!(util::check::docker_ident(tag), "invalid tag");

let max_upload_size = match input.kind {
BuildKind::DockerImage | BuildKind::OciBundle => MAX_UPLOAD_SIZE,
BuildKind::JavaScript => MAX_JS_BUILD_UPLOAD_SIZE,
};
ensure_with!(
image_file.content_length < MAX_UPLOAD_SIZE,
image_file.content_length < max_upload_size,
UPLOAD_TOO_LARGE
);

Expand Down

0 comments on commit 2ffc65b

Please sign in to comment.