forked from extern/nushell
fix conflict between filesize and hexadecimal numbers (#9309)
closes #9278 # Description removes ambiguity between the `b` the filesize `bytes` unit and `b` the hex digit
This commit is contained in:
@ -2217,6 +2217,12 @@ pub fn parse_filesize(working_set: &mut StateWorkingSet, span: Span) -> Expressi
|
||||
|
||||
let bytes = working_set.get_span_contents(span);
|
||||
|
||||
// the hex digit `b` might be mistaken for the unit `b`, so check that first
|
||||
if bytes.starts_with(b"0x") {
|
||||
working_set.error(ParseError::Expected("filesize with valid units", span));
|
||||
return garbage(span);
|
||||
}
|
||||
|
||||
match parse_unit_value(bytes, span, FILESIZE_UNIT_GROUPS, Type::Filesize, |x| {
|
||||
x.to_uppercase()
|
||||
}) {
|
||||
|
Reference in New Issue
Block a user