@@ -35,7 +35,7 @@ pub enum ContentType {
3535 TraceMetricContainer ,
3636 /// `application/vnd.sentry.trace-attachment`
3737 TraceAttachment ,
38- /// `application/vnd.sentry.attachment-ref`
38+ /// `application/vnd.sentry.attachment-ref+json `
3939 AttachmentRef ,
4040 /// All integration content types.
4141 Integration ( Integration ) ,
@@ -58,7 +58,7 @@ impl ContentType {
5858 Self :: SpanV2Container => "application/vnd.sentry.items.span.v2+json" ,
5959 Self :: TraceMetricContainer => "application/vnd.sentry.items.trace-metric+json" ,
6060 Self :: TraceAttachment => "application/vnd.sentry.trace-attachment" ,
61- Self :: AttachmentRef => "application/vnd.sentry.attachment-ref" ,
61+ Self :: AttachmentRef => "application/vnd.sentry.attachment-ref+json " ,
6262 Self :: Integration ( integration) => integration. as_content_type ( ) ,
6363 }
6464 }
@@ -104,7 +104,9 @@ impl ContentType {
104104 || ct. eq_ignore_ascii_case ( "application/vnd.sentry.attachment.v2" )
105105 {
106106 Some ( Self :: TraceAttachment )
107- } else if ct. eq_ignore_ascii_case ( Self :: AttachmentRef . as_str ( ) ) {
107+ } else if ct. eq_ignore_ascii_case ( Self :: AttachmentRef . as_str ( ) )
108+ || ct. eq_ignore_ascii_case ( "application/vnd.sentry.attachment-ref" )
109+ {
108110 Some ( Self :: AttachmentRef )
109111 } else {
110112 Integration :: from_content_type ( ct) . map ( Self :: Integration )
@@ -186,3 +188,20 @@ impl serde::Serialize for ContentType {
186188}
187189
188190relay_common:: impl_str_de!( ContentType , "a content type string" ) ;
191+
192+ #[ cfg( test) ]
193+ mod tests {
194+ use super :: * ;
195+
196+ #[ test]
197+ fn attachment_ref_roundtrip ( ) {
198+ let canonical_name = "application/vnd.sentry.attachment-ref+json" ;
199+ let ct = ContentType :: from_str ( canonical_name) . unwrap ( ) ;
200+ assert_eq ! ( ct, ContentType :: AttachmentRef ) ;
201+ assert_eq ! ( canonical_name, ct. as_str( ) ) ;
202+
203+ let legacy_alias = "application/vnd.sentry.attachment-ref" ;
204+ let ct = ContentType :: from_str ( legacy_alias) . unwrap ( ) ;
205+ assert_eq ! ( ct, ContentType :: AttachmentRef ) ;
206+ }
207+ }
0 commit comments