mirror of
https://github.com/talwat/lowfi
synced 2025-02-15 20:12:01 +00:00
fix: properly trim volume content before stripping percentage sign (#18)
This commit is contained in:
parent
4207016e82
commit
5eeee8069c
@ -44,7 +44,8 @@ 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.trim().strip_suffix("%").unwrap_or(&contents);
|
||||
let trimmed = contents.trim();
|
||||
let stripped = trimmed.strip_suffix("%").unwrap_or(&trimmed);
|
||||
stripped
|
||||
.parse()
|
||||
.map_err(|_| eyre!("volume.txt file is invalid"))?
|
||||
|
Loading…
x
Reference in New Issue
Block a user