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.
As requested in the Media module (https://www.drupal.org/node/2049027), it would be nice to set a file size limit per file type (extension).
Comment | File | Size | Author |
---|---|---|---|
#3 | file_entity-file-size-limit-per-file-type-2530656-3.patch | 5.32 KB | kennethos |
#1 | file_entity-file-size-limit-per-file-type-2530656-1.patch | 4.86 KB | kennethos |
Comments
Comment #1
kennethos CreditAttribution: kennethos at Randstad Digital commentedComment #3
kennethos CreditAttribution: kennethos at Randstad Digital commentedComment #4
kennethos CreditAttribution: kennethos at Randstad Digital commentedComment #5
robbertnl CreditAttribution: robbertnl at Wowww commentedSeems to work. I would suggest adding file size hints.
This patch requires to seperate 'Default allowed file extensions' in spaces only. It will throw an error if you are using a comma
Comment #6
robbertnl CreditAttribution: robbertnl at Wowww commentedComment #7
azinck CreditAttribution: azinck commentedThis works well for me. #5 is true, but it turns out that's actually a bug in Drupal core. Despite description text indicating that either comma-separated or space-separated values are ok, file_validate_extensions() will very clearly *only* work with space-separated values.
Comment #8
azinck CreditAttribution: azinck commentedActually, I looked a little closer and comma-separated values *are*, in fact, allowed by core. It cleans up these commas in _file_generic_settings_extensions() before saving the list. File Entity, however, doesn't add that particular validation function to this field. I've taken out that issue: #2796065: Default allowed file extensions help text is inaccurate; comma-separation is not allowed
But that shouldn't hold up this patch.
Comment #9
azinck CreditAttribution: azinck commentedMeant to mark RTBC.
Comment #10
darrell_ulm CreditAttribution: darrell_ulm as a volunteer commentedIs this added in yet? Looks like not, correct?
Comment #11
joseph.olstadIt's late for the last release. Although I could stick it into the 7.x-2.x dev and 7.x-3.x dev branches.
patch still applies correctly, although it leaves some garbage .orig files.
Comment #12
joseph.olstadI believe #2796065: Default allowed file extensions help text is inaccurate; comma-separation is not allowed
should also be committed with this.
make sure both patches pass tests.
Comment #13
joseph.olstadComment #14
joseph.olstadI realise it's been 4 years, the patch still applies though.
Anyone still want this functionality in the next release?
Comment #15
joseph.olstadEditted
Comment #16
darrell_ulm CreditAttribution: darrell_ulm as a volunteer commentedWe still do, thanks for the update.
Comment #17
joseph.olstadok, I tested this, seems to work well.
Comment #20
joseph.olstadThis is in dev, most likely will be in the next release.