[TYPO3-media] Where to put method: getUniqueName and sanitizeFileName

Fabien Udriot fabien.udriot at ecodev.ch
Mon Nov 28 06:18:34 CET 2011


Hi,

I need your opinion about API organization. The current situation is the following:

* method getUniqueName() is in the Storage. Purpose: make sure the file name is unique.
* method sanitizeFileName() in in the Local Driver. Purpose: make the file name be web-friendly 
(remove white spaces,...)

Both methods have something in common since they are dealing with the file name and I wonder whether 
they are at right place. Why aren't they at the same spot?

At the first glance, getUniqueName() would be rather something for the driver, isn't? E.g An Amazon 
storage might have different way of getting an unique name instead of adding a "_01" suffix at the 
end of the file.

So, what to do? I need an answer since I have a bug in the upload procedure and will need to update 
the API: the File Name is currently not sanitized. (e.g "My File.jpg" is not renamed "My_File.jpg")

* Keep the situation as it is?
* Move method around? What do you suggest here? Take also into consideration that we might possibly 
share these functions among drivers that are just a remote regular file system (FTP, WebDav, 
whatever, ...). I am thinking towards some Static Utility method. Just a thought!

I am on-line in case it would need further explanation.

Have a nice day.

Fabien


More information about the TYPO3-project-media mailing list