diff --git a/relay-server/src/utils/tus.rs b/relay-server/src/utils/tus.rs index 9969ab6efb5..1fc89bd83b6 100644 --- a/relay-server/src/utils/tus.rs +++ b/relay-server/src/utils/tus.rs @@ -92,6 +92,7 @@ pub struct Metadata { /// The [`AttachmentType`] of the upload. /// /// Used for preliminary rate-limiting checks. + #[serde(default)] pub attachment_type: AttachmentType, } @@ -384,11 +385,21 @@ mod tests { #[test] fn test_parse_sentry_metadata_invalid_json() { assert!(matches!( - parse_sentry_metadata("e30="), + parse_sentry_metadata("ew=="), Err(Error::InvalidMetadata(_)) )); } + #[test] + fn test_parse_sentry_metadata_default() { + assert!(matches!( + parse_sentry_metadata("e30="), + Ok(Metadata { + attachment_type: AttachmentType::Attachment + }) + )); + } + #[test] fn test_upload_metadata_absent() { assert_eq!(upload_metadata(&HeaderMap::new()).unwrap(), None);