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

BlackOps

New Member
Nov 20, 2018
7
0
1
53
#1
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
1,706
29
48
mfscripts.com
WEBSITE
https://yetishare.com
LOCATION
UK
#2
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
1,706
29
48
mfscripts.com
WEBSITE
https://yetishare.com
LOCATION
UK
#3
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
1,706
29
48
mfscripts.com
WEBSITE
https://yetishare.com
LOCATION
UK
#4
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
53
#5
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

New Member
YetiShare User
Jul 28, 2017
29
7
3
#7
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
1,706
29
48
mfscripts.com
WEBSITE
https://yetishare.com
LOCATION
UK
#8
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.