Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
make sure we don't try to decompress non-gzip requests
Browse files Browse the repository at this point in the history
  • Loading branch information
xvello committed Sep 14, 2023
1 parent fadf84a commit 9e76ac4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions capture/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use uuid::Uuid;
#[derive(Deserialize, Default)]
pub enum Compression {
#[default]
Unsupported,

#[serde(rename = "gzip-js")]
GzipJs,
}
Expand Down Expand Up @@ -87,6 +89,12 @@ impl RawEvent {
})?;
s
}
Some(_) => {
return Err(CaptureError::RequestDecodingError(String::from(
"unsupported compression format",
)))
}

None => String::from_utf8(bytes.into()).map_err(|e| {
tracing::error!("failed to decode body: {}", e);
CaptureError::RequestDecodingError(String::from("invalid body encoding"))
Expand Down

0 comments on commit 9e76ac4

Please sign in to comment.