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).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kennethos’s picture

Status: Needs review » Needs work

The last submitted patch, 1: file_entity-file-size-limit-per-file-type-2530656-1.patch, failed testing.

kennethos’s picture

kennethos’s picture

Status: Needs work » Needs review
robbertnl’s picture

Seems 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

robbertnl’s picture

Status: Needs review » Needs work
azinck’s picture

Status: Needs work » Needs review

This 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.

azinck’s picture

Actually, 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.

azinck’s picture

Status: Needs review » Reviewed & tested by the community

Meant to mark RTBC.

darrell_ulm’s picture

Is this added in yet? Looks like not, correct?

joseph.olstad’s picture

It'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.

joseph.olstad’s picture

I 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.

joseph.olstad’s picture

joseph.olstad’s picture

I realise it's been 4 years, the patch still applies though.

Anyone still want this functionality in the next release?

joseph.olstad’s picture

Editted

darrell_ulm’s picture

We still do, thanks for the update.

joseph.olstad’s picture

ok, I tested this, seems to work well.

joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

This is in dev, most likely will be in the next release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.