- Issue created by @selpi
- πΊπΈUnited States TolstoyDotCom L.A.
MediaTypeManager::getTargetFieldMaxSize can call format_size(), which outputs something like '2 MB'. Then MediaBulkUploadForm::isMaxFileSizeLarger calls Drupal\Component\Utility\Bytes::toNumber() to convert '2 MB' back to 2097152 so it can compare with the other value.
It seems like the module should instead pass around max filesize as an int (unless that would run into PHP_INT_MAX issues). In any case, it shouldn't deal with formatted sizes. The max filesize should only be formatted when shown to the user.
Are there issues with doing it like that instead?
- Status changed to Needs review
over 1 year ago 6:40pm 12 August 2023 - π©πͺGermany thomaswalther Rhein-Main Area
A format_size is also in media for the image type (/admin/structure/media/manage/image/fields/media.image.field_media_image):
For this feature, an author does not know the large number and can enter the short version. I think this is only an author friendly plain textfield for technical numbers.
I think the problem would be also on these settings, if the localized ending "ΠΠ" will NOT match for "MB".
Maybe it is a core problem for this field/setting, if there is a wrong match, no errors will be shown.