Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#25643 closed defect (bug) (fixed)

Upload size unit off by 1

Reported by: betzster's profile betzster Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version:
Component: Upload Keywords: 4.0-early has-patch commit
Focuses: Cc:


The upload unit will report 1GB as 1024MB because it doesn't divide the last time if the size limit is exactly 1GB.

Attachments (2)

25643.patch (1.1 KB) - added by betzster 10 years ago.
Fix the off by 1 error in the upload size unit calculation
25643.diff (2.5 KB) - added by wonderboymusic 9 years ago.

Download all attachments as: .zip

Change History (7)

10 years ago

Fix the off by 1 error in the upload size unit calculation

#1 @mark-k
10 years ago

Since we report binary sizes, isn't it better to use KiB, MiB, GiB, or just start report sizes in decimal?

#2 @nacin
9 years ago

  • Component changed from General to Upload

#3 @SergeyBiryukov
9 years ago

  • Keywords 4.0-early added
  • Milestone changed from Awaiting Review to Future Release

Can we use size_format() here?

9 years ago

#4 @wonderboymusic
9 years ago

  • Keywords has-patch commit added
  • Milestone changed from Future Release to 4.0

25643.diff uses size_format() (like a boss).

#5 @wonderboymusic
9 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 28343:

Leverage size_format() when displaying max_upload_size:

  • In media_upload_form()
  • The uploader-inline Underscore template in the media modal.

Replaces 2 buggy inline implementations that could display size units off by one, or size values off by one.

Fixes #25643.

Note: See TracTickets for help on using tickets.