Bug #15820
closed
filelink doesn't list files with a comma in the filename
Added by Stefan Strasser over 18 years ago.
Updated about 6 years ago.
Description
filelink-pagecontent does not list files with a comma in the filename if "read from a path" is given.
Otherwise, if I wan't to display a single file (with a comma in its name) it is listed in the typo3-element-browser, but if I want to choose it there, it occurs a error-message "ERROR: Invalid character found in file path (, |), cannot add the file!".
This could eventually be a feature, but for me it is a bug, because I have to list files which have a comma (or two) in its filename.
Probably the object which handles the filelist separates files with commas and isn't able to handle commas in the filename as a special-character ('escaping')?
This bug is not new, since I had this experience first with 3.7.0. Sorry for reporting it so late.
(issue imported from #M2861)
"Probably the object which handles the filelist separates files with commas and isn't able to handle commas in the filename as a special-character ('escaping')?"
It does seperate lists with commas - and this behaviour is spread all over typo3. If the characters would be escaped (commas can't be escaped, do they?) the filename would be permanently renamed - so you won't have commas in the selected downloadable files in any case. And as a fix for that might cause major changes in many many files I think this 'bug' will never be fixed - but I'm no core-developer.
It is anyway bad practice to use them in downloadable files as some NON-Windows-OS might not allow this character in filenames. Windows f.e. doesn't allow "/" in filenames, but Macintosh does - so you won't be happy if you have to download a file with this character..
I don't think TYPO3 will support commas in filenames. TYPO3 is extremly strict: only letters, digits and a few extra characters (_-.) are supported. TYPO3 tries to handle them (ie either by converting or by denying) them on adding into TYPO3.
Of course it cannot prevent you adding tem to fileadmin via file system or ftp.
Thank you for your answers!
From the view of the typo3-code I think I see the problem. But from a customer-view I don't.
If I would work for a typo3-agency I would have a problem to explain to my customer why typo3 can't handle files with commas in their name (not only possible on Windows, also on Linux and I think also on Mac). Here is IMHO an example of user experience that is a sacrifice of the perfect code as Kasper wrote soon in an article in "T3N Magazin 01/06" about Version 4.5 and usability.
I have for example a directory with about 300 files with song-names in their filename and let's say about 10% have a comma in it. T3 is not the main application to handle these (existing) files and therefore I can't just change the filenames as they have to be for Typo3.
There is a strict way to handle special-chars, but there is also another, more open way. Just for example: if you print out some html-code with php and you have to use chars like " you have to escape them: print "<img src=\"fileadmin...\">"; I think there should be a way to escape commas transparently.
As I read your notes I think this issue has perhaps not be handled as a bug but as a feature-request for 4.5.
Problem is, that there is no common escaping-rule for commas as far as I know. And caused of the typo3 handling of list-entries with trimExplode by comma I guess escaping won't help much here. Therefore a general change for a list-separation-character would be necessary. And that would drasticly conflict with backwards-compatibility and would break many extensions.
The strict 'limitation' should be caused by common internet-filename guidelines. If you need special treatment I guess it's up to you to change the typo3-framework the way you need it.
Have you tested inserting files by DAM relations (experimental extension) with your filename problem? I think this could handle your issue as it works with DB-relations and not on filesystem basis. And if it currently doesn't work I think you can create an extensoin that renders the filelinks with a user_function - or try one of the allready existing ones.
Ok, I see I want too much :-)
Thank you Franz for the hints, I'll try the existing extensions before I look for a workaround myself.
I think, this issue can therefore be closed or do you want to wait with it until I report a success with some extension?
I can't say if 'you want too much' as the things I mentioned are not officially acknowledged and I'm no core developer that knows what happens everywhere. I'm speeking with the knowledge from my experiences with typo3 and what I found in the source (file:class.tslib_content.php, function file_list). There the separation-mark is a hardcoded comma.
If your main problem ONLY occurs when reading files from a directory, it would be enough to make this separation-mark configurable via TS and use the constant defining the mark as splitchar in the 'listNum'-function. Than at least reading files with commas in their names from a directory should work.
You can write a script under UNIX/LINUX which creates a list of symbolic links to your files. Then you can use the symbolic link names like normal files.
Franz Koch: thanks. Sounds nice, but in the moment I'm not able to do this by myself. Maybe my typo3-knowledge grows and I may try it - or someone else does it.
Franz Holzinger: nice idea! I think I'll do it this way.
Files with comma in their name cannot be uploaded via the filelist module. It does not matter, if you set [SYS][UTF8filesystem] or if you don't, the comma always is replaced by "_".
Also after the above discussion I think that's a "Won't fix."
- Status changed from Resolved to Closed
Also available in: Atom
PDF