diff options
author | Alex Auvolat <lx@deuxfleurs.fr> | 2025-02-18 12:55:45 +0100 |
---|---|---|
committer | Alex Auvolat <lx@deuxfleurs.fr> | 2025-02-18 15:33:42 +0100 |
commit | ccab0e4ae5c083d0a06ad2b3ef5fe62481da3c2c (patch) | |
tree | b05ec0bfc3bcc98075327d701fc2e622fe06da27 | |
parent | abb60dcf7e97b19ab7b82015cc12d9006cbe3dda (diff) | |
download | garage-ccab0e4ae5c083d0a06ad2b3ef5fe62481da3c2c.tar.gz garage-ccab0e4ae5c083d0a06ad2b3ef5fe62481da3c2c.zip |
api: fix optional \n after trailer checksum header
-rw-r--r-- | src/api/common/signature/streaming.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/api/common/signature/streaming.rs b/src/api/common/signature/streaming.rs index 17d3a802..75f3bf80 100644 --- a/src/api/common/signature/streaming.rs +++ b/src/api/common/signature/streaming.rs @@ -189,7 +189,7 @@ mod payload { use nom::bytes::streaming::{tag, take_while}; use nom::character::streaming::hex_digit1; - use nom::combinator::map_res; + use nom::combinator::{map_res, opt}; use nom::number::streaming::hex_u32; macro_rules! try_parse { @@ -266,6 +266,11 @@ mod payload { let (input, header_value) = try_parse!(take_while( |c: u8| c.is_ascii_alphanumeric() || b"+/=".contains(&c) )(input)); + + // Possible '\n' after the header value, depends on clients + // https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html + let (input, _) = try_parse!(opt(tag(b"\n"))(input)); + let (input, _) = try_parse!(tag(b"\r\n")(input)); Ok(( |