From 5b546ea2de2aeb0d50dfc1d83e3d068b0e245e74 Mon Sep 17 00:00:00 2001 From: Timo Furrer Date: Mon, 7 Oct 2024 15:19:50 +0200 Subject: [PATCH] fix: trim whitespace from volume contents (#16) --- src/play.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/play.rs b/src/play.rs index 1946392..0e7d507 100644 --- a/src/play.rs +++ b/src/play.rs @@ -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"))?