diff --git a/CHANGELOG.md b/CHANGELOG.md index dc1cc387..e67944c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed +- **uplc**: trim whitespace when loading files with hex strings to avoid confusing errors #720 - **uplc**: uplc `Constant::Data` formatting - **aiken-lang**: empty records properly parse as record sugar - **aiken-project**: when a module name has a hyphen we should behave like rust and force an underscore diff --git a/crates/aiken/src/cmd/uplc/decode.rs b/crates/aiken/src/cmd/uplc/decode.rs index ac8036dc..c6eb74d3 100644 --- a/crates/aiken/src/cmd/uplc/decode.rs +++ b/crates/aiken/src/cmd/uplc/decode.rs @@ -34,7 +34,7 @@ pub fn exec( let bytes = if hex { let hex_bytes = std::fs::read_to_string(&input).into_diagnostic()?; - hex::decode(hex_bytes).into_diagnostic()? + hex::decode(hex_bytes.trim()).into_diagnostic()? } else { std::fs::read(&input).into_diagnostic()? }; diff --git a/crates/aiken/src/cmd/uplc/eval.rs b/crates/aiken/src/cmd/uplc/eval.rs index cdddd935..5b70d166 100644 --- a/crates/aiken/src/cmd/uplc/eval.rs +++ b/crates/aiken/src/cmd/uplc/eval.rs @@ -33,7 +33,7 @@ pub fn exec( let mut program = if cbor { let cbor_hex = std::fs::read_to_string(&script).into_diagnostic()?; - let raw_cbor = hex::decode(cbor_hex).into_diagnostic()?; + let raw_cbor = hex::decode(cbor_hex.trim()).into_diagnostic()?; let prog = Program::::from_cbor(&raw_cbor, &mut Vec::new()) .into_diagnostic()?;