Skip to content

fix wrong casting with into filesize#13110

Merged
WindSoilder merged 2 commits intonushell:mainfrom
hqsz:fix_cast_error_possibility
Jun 10, 2024
Merged

fix wrong casting with into filesize#13110
WindSoilder merged 2 commits intonushell:mainfrom
hqsz:fix_cast_error_possibility

Conversation

@hqsz
Copy link
Copy Markdown
Contributor

@hqsz hqsz commented Jun 9, 2024

Description

Fix wrong casting which is related to #12974 (comment)

User-Facing Changes

AS-IS (before fixing)

$ "-10000PiB" | into filesize
6.2 EiB                                                         <--- Wrong casted value
$ "10000PiB" | into filesize 
-6.2 EiB                                                        <--- Wrong casted value

TO-BE (after fixing)

$ "-10000PiB" | into filesize
Error: nu::shell::cant_convert

  × Can't convert to filesize.
   ╭─[entry #6:1:1]
 1 │ "-10000PiB" | into filesize
   · ─────┬─────
   ·      ╰── can't convert string to filesize
   ╰────

$ "10000PiB" | into filesize
Error: nu::shell::cant_convert

  × Can't convert to filesize.
   ╭─[entry #7:1:1]
 1 │ "10000PiB" | into filesize
   · ─────┬────
   ·      ╰── can't convert string to filesize
   ╰────

Copy link
Copy Markdown
Contributor

@WindSoilder WindSoilder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It's a good change

@WindSoilder WindSoilder merged commit dc76183 into nushell:main Jun 10, 2024
@IanManske IanManske added the notes:fixes Include the release notes summary in the "Bug fixes" section label Jun 10, 2024
@hustcer hustcer added this to the v0.95.0 milestone Jun 10, 2024
@hqsz hqsz deleted the fix_cast_error_possibility branch July 3, 2024 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:fixes Include the release notes summary in the "Bug fixes" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants