Bug tracker
False conversion from MiB to MiB (fix completed in vcs)
If the value I insert is less or equal than 1023 MiB then it will not be divided with 1024 and will show as is.
This started after i updated from 3.0.4 to 3.0.5.
Comments / History
Total Attachment quota:
At start I entered 3.072.000 MiB so after submit the field said 3000 MiB. Of course i was able to upload a file 3.5MB.
I deleted this file, i pressed once again submit, without changing anything, so because the field had 3000 after submit this value was 3000/1024= 2.93 MiB. Again i was able to upload the same file (3.5MB).
I deleted it once again, again pressed submit so the value remained 2.93 MiB (because the original value was less than 1024) and now i wasn't able to upload it because i had reached the board quota.
So it seems that the actual quotum doesn't end up divided but only the reading on the field.
Totally different things happened with "Maximum file size" which seems not to be working at all. Even if I entered 1024 MiB (so after submit it would say 1 MiB), or directly 1 MiB, or even 1024 KiB (so after submit it would say again 1 MiB) I was still able to upload the same file of 3.5 MB. Maybe this is happening becuase I am the founder of the board so i can bypass this limit but I am not sure about that.
If you have more questions please let me know.
In functions_content.php search for
- Code: Select all
$filesize = $attachment['filesize'];
$size_lang = ($filesize >= 1048576) ? $user->lang['MIB'] : (($filesize >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES']);
$filesize = get_formatted_filesize($filesize, false);
$comment = bbcode_nl2br(censor_text($attachment['attach_comment']));
$block_array += array(
'UPLOAD_ICON' => $upload_icon,
'FILESIZE' => $filesize,
'SIZE_LANG' => $size_lang,
'DOWNLOAD_NAME' => basename($attachment['real_filename']),
'COMMENT' => $comment,
);
and replace it with
- Code: Select all
$filesize = get_formatted_filesize($attachment['filesize']);
$comment = bbcode_nl2br(censor_text($attachment['attach_comment']));
$block_array += array(
'UPLOAD_ICON' => $upload_icon,
'FILESIZE' => $filesize,
'SIZE_LANG' => '',
'DOWNLOAD_NAME' => basename($attachment['real_filename']),
'COMMENT' => $comment,
);
The $size_lang is not needed because the function get_formatted_filesize puts the right suffix if you don't send false as second argument. Also the template variable SIZE_LANG is not necessary.
Regards,
Tekin