Skip to content
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
721 changes: 444 additions & 277 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ android_trace_log = { version = "0.3", features = ["serde"] }
# Keep it pinned until it's possible to disable backtrace.
anyhow = "=1.0.69"
arc-swap = "1"
async-compression = { version = "0.4", features = ["tokio", "gzip", "brotli", "deflate", "zstd", "bzip2", "xz"] }
async-compression = { version = "0.4", features = [
"brotli",
"bzip2",
"deflate",
"gzip",
"tokio",
"xz",
"zstd",
] }
async-trait = "0.1"
axum = "0.8"
axum-extra = "0.12"
Expand Down Expand Up @@ -153,7 +161,7 @@ metrics = "0.24"
metrics-exporter-dogstatsd = "0.9"
num-traits = "0.2"
num_cpus = "1"
objectstore-client = "0.1"
objectstore-client = { version = "0.1", features = ["multipart"] }
opentelemetry-semantic-conventions = "0.31"
opentelemetry-proto = { version = "0.31", default-features = false }
papaya = "0.2"
Expand Down
19 changes: 13 additions & 6 deletions relay-server/src/endpoints/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use crate::services::objectstore;
use crate::services::projects::cache::Project;
use crate::services::projects::project::ProjectState;
use crate::services::upload::{
self, ByteStream, Final, LocationQueryParams, ProjectContext, Provisional, SignedLocation,
UploadLength,
self, ByteStream, Final, LocationData, LocationQueryParams, ProjectContext, Provisional,
SignedLocation,
};
use crate::services::upstream::UpstreamRequestError;
use crate::statsd::RelayCounters;
Expand Down Expand Up @@ -133,7 +133,7 @@ impl IntoResponse for Error {
}
}

impl<L: UploadLength> IntoResponse for SignedLocation<L> {
impl<L: LocationData> IntoResponse for SignedLocation<L> {
fn into_response(self) -> Response {
let mut headers = tus::response_headers();
match self.into_header_value() {
Expand Down Expand Up @@ -204,6 +204,7 @@ async fn handle_patch(
Path(upload::LocationPath { project_id, key }): Path<upload::LocationPath>,
Query(LocationQueryParams {
upload_length,
upload_id,
upload_signature,
other,
}): Query<LocationQueryParams<Provisional>>,
Expand All @@ -214,8 +215,14 @@ async fn handle_patch(
relay_log::trace!("Validating headers");
tus::validate_patch_headers(&headers).map_err(Error::from)?;

let location =
SignedLocation::from_parts(project_id, key, upload_length, upload_signature, other);
let location = SignedLocation::from_parts(
project_id,
key,
upload_length,
upload_id,
upload_signature,
other,
);

let config = state.config();

Expand All @@ -240,7 +247,7 @@ async fn handle_patch(
.boxed();
let stream = MeteredStream::new(stream, "upload");

let (lower_bound, upper_bound) = match upload_length.value() {
let (lower_bound, upper_bound) = match upload_length {
None => (1, config.max_upload_size()),
Some(u) => (u, u),
};
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/processing/utils/attachments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn validate(item: &Item, config: &Config) -> Result<(), ProcessingError> {
let location = signed_location
.verify(chrono::Utc::now(), config)
.map_err(|_| ProcessingError::InvalidAttachmentRef)?;
let signed_length = location.length.into_inner();
let signed_length = location.location_data.length();

match item.attachment_body_size() == signed_length {
true => Ok(()),
Expand Down
Loading