Page MenuHomePhabricator

File sizes should respect the user OS (SI units vs. Non-SI units)
Closed, DeclinedPublic

Description

https://www.mediawiki.org/wiki/File:Whole_world_-_land_and_oceans.jpg

This image is displayed as 5.84 MB. In fact that is only true on Windows (5,83 MB to be exact).

It's wrong on all other OS like Linux and Mac where it's 6.1 MB after downloading.

The reason is that Linux based OS calculate B > KB > MB > GB by 1000*1000 bytes and Windows by 1024*1024 bytes.

MediaWiki should respect that and display the correct file size for the user by testing the

$_SERVER['HTTP_USER_AGENT']

Considerations:

  • PHP caching could be a possible trouble maker tho.
  • Javascript would be live but "flashing" since it's above the fold

Event Timeline

Subfader raised the priority of this task from to Needs Triage.
Subfader updated the task description. (Show Details)
Subfader subscribed.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Subfader set Security to None.
Subfader updated the task description. (Show Details)
Subfader updated the task description. (Show Details)
Subfader updated the task description. (Show Details)

Wouldn't it be more prudent to decide on a convention and then display that somewhere instead of modifying the shown file size depending on user agent?

Also, while nautilus does show the file size as 6.1 MB, ls -lh on Ubuntu shows 5.9M as the size. Using the --si flag changes it to 6.2M.

Aklapper renamed this task from File sizes should respect the user OS to File sizes should respect the user OS (SI units vs. Non-SI units).May 19 2015, 6:05 PM
Aklapper triaged this task as Lowest priority.
brion claimed this task.
brion subscribed.

Flipping displayed unit scales around based on guessing host OS from user-agent sniffing sounds like a really confusing idea; I'm going to go ahead and decline the request rather than leaving it open.

See also https://phabricator.wikimedia.org/T54687