KitFieldhouse commented on code in PR #542:
URL: https://github.com/apache/avro-rs/pull/542#discussion_r3186381972
##########
avro/src/types.rs:
##########
@@ -1029,7 +1029,15 @@ impl Value {
Err(Details::CompareFixedSizes { size, n }.into())
}
}
- Value::String(s) => Ok(Value::Fixed(s.len(), s.into_bytes())),
+ Value::String(s) => {
+ if s.len() > size {
+ Err(Details::CompareFixedSizes { size, n: s.len() }.into())
+ } else {
+ let mut bytes = s.into_bytes();
+ bytes.resize(size, 0);
Review Comment:
Sounds good, I agree with that logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]