Closed the the 999 thread, but it is just a simple bug

BlackOps

New Member
Nov 20, 2018
7
0
1
59
The widget reads correctly if there are no files stored above the one TB level.

1TB.PNG


But if you use any space (upload files) the widget kinda runs home to mom lol :)




1TB2.PNG


Oh and I did as you asked, and joined the account and submitted a ticket, but after researching different scenarios, that the deal right there, just a tiny bug.
 
Last edited:

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
Hi,

I'm having trouble replicating this on our demo site. I've increased the available storage for around 10TB for the admn account and it seems to show ok:

https://fhscript.com/account_edit.html
user: admin
pass: password

Are you only seeing the issue when files are uploaded. i.e. was that the only difference between your 2 screens above?

Also, are you using the latest release code?

Thanks,
Adam.
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
I just uploaded a file to test and weirdly I'm seeing the opposite of what you noticed, the "used storage" widget is failing! o_O

Capture.PNG

It's likely an int issue somehow, will run some further tests...
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
Hi,

I've spotted the issue, it relates to any values shown with a comma on the widget. Since 1TB is 1024GB, when you upload a file this no longer shows as 1TB available, instead 1,023GB for example, which forces a comma in the number. The widget can't handle this, I think in the animation run on page load. When you get to 999GB or below it would show fine again since the comma is removed.

You can patch the fix by opening:

/core/includes/coreFunctions.inc.php, find:

static function formatSize(

In that function find:

$size = str_replace(".00 ", " ", $size);

After add:

$size = str_replace(",", "", $size);

Let me know if this fixes it for you?

Thanks,
Adam.
 

BlackOps

New Member
Nov 20, 2018
7
0
1
59
Hi,

I've spotted the issue, it relates to any values shown with a comma on the widget. Since 1TB is 1024GB, when you upload a file this no longer shows as 1TB available, instead 1,023GB for example, which forces a comma in the number. The widget can't handle this, I think in the animation run on page load. When you get to 999GB or below it would show fine again since the comma is removed.

You can patch the fix by opening:

/core/includes/coreFunctions.inc.php, find:

static function formatSize(

In that function find:

$size = str_replace(".00 ", " ", $size);

After add:

$size = str_replace(",", "", $size);

Let me know if this fixes it for you?

Thanks,
Adam.
Hello Adam,

Thanks for looking into this, I am using the current release version, and changing the above code results in the following.

altered.PNG
 

worldofpcgames46668

Member
YetiShare User
YetiShare Supporter
Jul 28, 2017
99
20
8
Hi,

I've spotted the issue, it relates to any values shown with a comma on the widget. Since 1TB is 1024GB, when you upload a file this no longer shows as 1TB available, instead 1,023GB for example, which forces a comma in the number. The widget can't handle this, I think in the animation run on page load. When you get to 999GB or below it would show fine again since the comma is removed.

You can patch the fix by opening:

/core/includes/coreFunctions.inc.php, find:

static function formatSize(

In that function find:

$size = str_replace(".00 ", " ", $size);

After add:

$size = str_replace(",", "", $size);

Let me know if this fixes it for you?

Thanks,
Adam.
Adam please add these patches to the upcoming updates.
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
And adding a second file results in the same output.
View attachment 553
Try removing the rounding in the account_edit.html file. In:

/themes/flow/templates/account_edit.html

Find:

validation::safeOutputToScreen(coreFunctions::formatSize($totalFreeSpace, 'ext', false)

Replace with:

validation::safeOutputToScreen(coreFunctions::formatSize($totalFreeSpace, 'ext')

Find:

validation::safeOutputToScreen(coreFunctions::formatSize($totalFreeSpace, 'size', false))

Replace with:

validation::safeOutputToScreen(coreFunctions::formatSize($totalFreeSpace, 'size'))

You should see the GB be around 1023 since 1024 is assumed 1 TB.

Thanks,
Adam.
 

BlackOps

New Member
Nov 20, 2018
7
0
1
59
Well, getting warm, its showing a value, but I dont believe it is a correct value, it shows over 1 TB measured in GB

post3.PNG
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
It's less than 1TB, 1TB = 1024GB in this context. :)