fix: trim whitespace when loading hex strings from files closes #720
This commit is contained in:
		
							parent
							
								
									097d1fa893
								
							
						
					
					
						commit
						dfe433ea46
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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()?
 | 
			
		||||
    };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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::<FakeNamedDeBruijn>::from_cbor(&raw_cbor, &mut Vec::new())
 | 
			
		||||
            .into_diagnostic()?;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue