diff --git a/src/decode.rs b/src/decode.rs index 40584a68..a35166bb 100644 --- a/src/decode.rs +++ b/src/decode.rs @@ -216,7 +216,7 @@ fn decode_helper( // trailing whitespace is so common that it's worth it to check the last byte to // possibly return a better error message if let Some(b) = input.last() { - if decode_table[*b as usize] == tables::INVALID_VALUE { + if *b != b'=' && decode_table[*b as usize] == tables::INVALID_VALUE { return Err(DecodeError::InvalidByte(input.len() - 1, *b)); } } diff --git a/tests/decode.rs b/tests/decode.rs index fbe07691..44caef86 100644 --- a/tests/decode.rs +++ b/tests/decode.rs @@ -292,7 +292,7 @@ fn decode_reject_invalid_bytes_with_correct_error() { index ); - if length % 4 == 1 { + if length % 4 == 1 && !suffix.is_empty() { assert_eq!(DecodeError::InvalidLength, decode(&input).unwrap_err()); } else { assert_eq!(