Currently there's only one option for cleaning filenames: "Clean file upload filenames", which does everything or nothing.

It would be great to be able to control the individual processing functions of this (for example, sanitize paths without adding a unique id).

I've attached a patch that does the above, and a screenshot of the revised "Misc" pane.

Additionally I wrapped uniqid() in md5() for addtional entropy (because uniqid() often has identical leading characters, since it's time-seeded).

Comments

davidwhthomas’s picture

Hi,

Thanks for your interest in the clean filenames feature.

It's main purpose is to make the filename reflect the file context on the site.

That is, to use the node title or file description for the filename

To that extent, the current functionality could be extended to allow a filter for mimetypes / file extensions to exclude from renaming.

Other than that, the current processing is required to create sanitized filenames in the first place and shouldn't be optional.

The Drupal6 version uses

uniqid(rand(), true)

for added entropy in the appended code.

In any case, feel free to modify your local install for your needs.

DT

giorgio79’s picture

Thanks for this patch.

I was just looking to permit longer filenames than 60 characters because currently the maximum total length is 60 characters.I am using Drupal 6 version, hope the patch works there too.

bartezz’s picture

Thanks for the patch, finding it very usefull to have some more control over what this module does!

Cheers

jr8279’s picture

Can we get this patch for D6?