Skip to content

Commit 3226f66

Browse files
authored
fix: Trimming newlines from jwt files (#2560)
**Motivation** jwt.hex files can end in newlines, in particular odometer's test jwt. This change aims to handle that case. **Description** This change executes `trim_end_matches` on the `contents` read from a jwt.hex file passed to ethrex.
1 parent 5c27731 commit 3226f66

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cmd/ethrex/decode.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub fn jwtsecret_file(file: &mut File) -> Bytes {
1313
if contents[0..2] == *"0x" {
1414
contents = contents[2..contents.len()].to_string();
1515
}
16+
contents = contents.trim_end_matches('\n').to_string();
1617
hex::decode(contents)
1718
.expect("Secret should be hex encoded")
1819
.into()

0 commit comments

Comments
 (0)