File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ pub fn parse_size_string(size_str: &str) -> VolumeResult<u64> {
4242
4343 // Linux `df -B1` emits integer byte counts. Parse those directly so values above
4444 // f64's exact-integer range retain all bits of precision.
45- if unit. is_empty ( ) && !number_part. contains ( '.' ) {
45+ if ( unit. is_empty ( ) || unit . eq_ignore_ascii_case ( "B" ) ) && !number_part. contains ( '.' ) {
4646 return number_part
4747 . parse :: < u64 > ( )
4848 . map_err ( |_| VolumeError :: InvalidData ( format ! ( "Invalid size: {}" , size_str) ) ) ;
@@ -360,6 +360,10 @@ mod tests {
360360 parse_size_string( "9007199254740993" ) . unwrap( ) ,
361361 9_007_199_254_740_993
362362 ) ;
363+ assert_eq ! (
364+ parse_size_string( "9007199254740993B" ) . unwrap( ) ,
365+ 9_007_199_254_740_993
366+ ) ;
363367 assert_eq ! (
364368 parse_size_string( "1,5G" ) . unwrap( ) ,
365369 ( 1.5 * 1024.0 * 1024.0 * 1024.0 ) as u64
You can’t perform that action at this time.
0 commit comments