Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The upload module stores these two particular variables as a number of megabytes so we need to multiply by 1024^2 as happens elsewhere for these messages. Seeing that something exceeeds a 1 byte quota is a bit disconcerting when you have 1 MB.
I made the patch against HEAD, but the problem does exist in 4.6.x.
Comment | File | Size | Author |
---|---|---|---|
upload.module_4.diff | 2.02 KB | drumm | |
Comments
Comment #1
Dries CreditAttribution: Dries commentedCan't we store the size in bytes instead of having to multiply with '1024 * 1024' over and over again?
Comment #2
Dries CreditAttribution: Dries commentedNote: this patch does not apply against DRUPAL-4-6. For HEAD, we might be better of removing the multiplications, as stated in my previous comment.
Comment #3
drummThe value is stored with a call to
system_settings_save()
and the UI currently accepts a number of MB. I can't think of a good way to actually store the number of bytes instead of MB as the user entered. I suppose the best code cleanup for now would be grabbing the value in MB, multiplying, and storing in a locally scoped variable.If I have time later today I can make patches for both 4.6 and HEAD.
Comment #4
Dries CreditAttribution: Dries commentedOK. The patch does not apply against HEAD though.
Comment #5
Steven CreditAttribution: Steven commentedI fixed it in HEAD and 4.6. I moved the multiplications to right where the variable is fetched. That way it doesn't need to be multiplied again later.
Comment #6
(not verified) CreditAttribution: commented