Skip to content

Commit 33822e7

Browse files
author
Devdutt Shenoi
committed
fix: allow just byte count
1 parent 9e1d3c2 commit 33822e7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/utils/human_size.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ use serde::{de, Deserialize, Deserializer, Serializer};
55

66
// Function to convert human-readable size to bytes (already provided)
77
pub fn human_size_to_bytes(s: &str) -> Result<u64, String> {
8+
if let Ok(size) = s.parse() {
9+
return Ok(size);
10+
}
11+
812
fn parse_and_map<T: human_size::Multiple>(s: &str) -> Result<u64, human_size::ParsingError> {
913
SpecificSize::<T>::from_str(s).map(|x| x.to_bytes())
1014
}

0 commit comments

Comments
 (0)