Skip to content

Commit

Permalink
fix: trim whitespace from volume contents (talwat#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
timofurrer authored Oct 7, 2024
1 parent d9ba0c3 commit 5b546ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/play.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl InitialProperties {
// Basically just read from the volume file if it exists, otherwise return 100.
let volume = if volume.exists() {
let contents = fs::read_to_string(volume).await?;
let stripped = contents.strip_suffix("%").unwrap_or(&contents);
let stripped = contents.trim().strip_suffix("%").unwrap_or(&contents);
stripped
.parse()
.map_err(|_| eyre!("volume.txt file is invalid"))?
Expand Down

0 comments on commit 5b546ea

Please sign in to comment.