Allow finer control options for cleaning filenames

smokris - September 17, 2008 - 18:57
Project:Upload path
Version:5.x-1.1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

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

AttachmentSize
uploadpath-misc-settings.patch9.68 KB
uploadpaths-misc-settings-patch.png131.15 KB
uploadpath-misc-settings-patch.png131.15 KB

#1

davidwhthomas - September 17, 2008 - 21:46

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

#2

giorgio79 - November 15, 2008 - 07:43

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.

#3

Bartezz - February 3, 2009 - 15:45

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

Cheers

#4

jr8279 - March 4, 2009 - 14:18

Can we get this patch for D6?

 
 

Drupal is a registered trademark of Dries Buytaert.