fix: trim whitespace when loading hex strings from files closes #720

This commit is contained in:
rvcas 2023-08-31 18:22:09 -04:00
parent 097d1fa893
commit dfe433ea46
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
3 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@
### Fixed ### Fixed
- **uplc**: trim whitespace when loading files with hex strings to avoid confusing errors #720
- **uplc**: uplc `Constant::Data` formatting - **uplc**: uplc `Constant::Data` formatting
- **aiken-lang**: empty records properly parse as record sugar - **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 - **aiken-project**: when a module name has a hyphen we should behave like rust and force an underscore

View File

@ -34,7 +34,7 @@ pub fn exec(
let bytes = if hex { let bytes = if hex {
let hex_bytes = std::fs::read_to_string(&input).into_diagnostic()?; 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 { } else {
std::fs::read(&input).into_diagnostic()? std::fs::read(&input).into_diagnostic()?
}; };

View File

@ -33,7 +33,7 @@ pub fn exec(
let mut program = if cbor { let mut program = if cbor {
let cbor_hex = std::fs::read_to_string(&script).into_diagnostic()?; 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::<FakeNamedDeBruijn>::from_cbor(&raw_cbor, &mut Vec::new()) let prog = Program::<FakeNamedDeBruijn>::from_cbor(&raw_cbor, &mut Vec::new())
.into_diagnostic()?; .into_diagnostic()?;