Improve file size handling and parsing in browser.js#203
Open
Tristan-Duin wants to merge 1 commit into9001:hovudstraumfrom
Open
Improve file size handling and parsing in browser.js#203Tristan-Duin wants to merge 1 commit into9001:hovudstraumfrom
Tristan-Duin wants to merge 1 commit into9001:hovudstraumfrom
Conversation
- Add formatSize function for better size formatting - Store raw file sizes in data-sz attributes - Fix size parsing to handle both spaces and commas - Use humansize() for consistent display formatting
H4ckerxx44
reviewed
Jul 29, 2025
Comment on lines
+343
to
+345
| if (bytes < 1024) return bytes + ' B'; | ||
| let k = 1024; | ||
| let sizes = ['B', 'KB', 'MB', 'GB', 'TB']; |
There was a problem hiding this comment.
As you are using 1024 multiples, I recommbed the "-ibi" suffixes instead.
So Kibibyte (KiB), Mebibyte (MiB), and so on.
jurchiks
reviewed
Aug 27, 2025
| "f_chide": 'this will hide the column «{0}»\n\nyou can unhide columns in the settings tab', | ||
| "f_bigtxt": "this file is {0} MiB large -- really view as text?", | ||
|
|
||
| formatSize: function(bytes) { |
There was a problem hiding this comment.
Why is this function defined in translations?
jurchiks
reviewed
Aug 27, 2025
| if (!isNaN(numSz)) { | ||
| // Store original size as data attribute for other code that needs the raw value | ||
| oo[a].setAttribute('data-sz', numSz); | ||
| oo[a].textContent = humansize(numSz, false); |
There was a problem hiding this comment.
You created a new function called formatSize, but here you call humansize...?
And you don't call your own function anywhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I am new to contributing to open source, so if this broken or incorrect in some way; all feedback is appreciated.
This PR complies with the DCO; https://developercertificate.org/