fix: trim whitespace from volume contents (#16)

This commit is contained in:
Timo Furrer 2024-10-07 15:19:50 +02:00 committed by GitHub
parent d9ba0c3b3b
commit 5b546ea2de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"))?