Bug #29456
Use files.replace for schemeMarkers
| Status: | Closed | Start date: | 2011-09-02 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | Reinhard Führicht | % Done: | 100% |
|
| Category: | Finisher | |||
| Target version: | Stable v1.0 | Estimated time: | 0.50 hour | |
| Votes: | 0 |
Description
The schemeMarkers functionality within the Finisher_StoreUploadedFiles class is great but I found a small problem. When I try to use a field for renaming there is a chance a unwanted char is within the field value. This could be a space or even umlauts.
Solution would be to process the files.search and files.replace settings (and, of course its default) after the renaming (renameScheme).
Associated revisions
Use files.replace for schemeMarkers too (fixes #29456)
Use files.replace for schemeMarkers too (fixes #29456)
History
Updated by Reinhard Führicht over 1 year ago
- File 29456.patch added
- Status changed from New to Accepted
Hi Felix.
Please have a look at the attached patch and let me know, if this is what you expected.
It moves the replacement code from the controller to the utility class. Controller_Form and Finisher_StoreUploadedFiles then use the same methods to do the replacement.
Furthermore I changed the parsing of the TypoScript settings "search" and "replace" in order to allow spaces in the comma separated list.
Updated by Reinhard Führicht over 1 year ago
- Status changed from Accepted to Resolved
- % Done changed from 0 to 100
Applied in changeset r52414.
Updated by Felix Nagel over 1 year ago
Iv tested the latest trunk and still have renamed files like "Surname Name_1317040694_OriginalFileName.pdf" when using somethink like:
renameScheme = [namemarker]_[time]_[filename]
schemeMarkers {
namemarker = fieldValue
namemarker.field = name
}
This problem is not solved.
Updated by Reinhard Führicht over 1 year ago
- Status changed from Resolved to Accepted
What's your configuration for "search" and "replace"?
You should put a space in there, because the default replacement gets overwritten by the one in TS.
Here is the part of the code:
//Default: Replace spaces with underscores
$search = array(' ', '%20');
$replace = array('_');
//The settings "search" and "replace" are comma separated lists
if($settings['files.']['search']) {
$search = explode(',', $settings['files.']['search']);
}
if($settings['files.']['replace']) {
$replace = explode(',', $settings['files.']['replace']);
}
$fileName = str_replace($search, $replace, $fileName);
Updated by Felix Nagel over 1 year ago
Ahh, thats my mistake. Works great now, thanks for your help!
Could be closed!
Updated by Reinhard Führicht over 1 year ago
- Status changed from Accepted to Closed