[BUGFIX] Fix processed files if original has special chars 29/18529/4
authorHelmut Hummel <helmut.hummel@typo3.org>
Thu, 21 Mar 2013 23:09:15 +0000 (00:09 +0100)
committerBenjamin Mack <benni@typo3.org>
Sat, 6 Apr 2013 14:57:12 +0000 (16:57 +0200)
Filenames of files uploaded in TYPO3 CMS before 6.0.1
can contain problematic characters, because filename
sanitizing of added files was introduced with 6.0.1.

The same happens if files are not uploaded through
the TYPO3 backend and then indexed.

The filenames of processed files are sanitized when
adding them to the storage but the not sanitized
original filename identifier is kept in the database
record of the processed files, which causes wrong
generated paths.

Update the identifier of the processed file along
with all other properties after adding them
to the storage.

Change-Id: I53e4eb42def291ba88ce18209a348b1e2f592185
Resolves: #45221
Related: #42925
Releases: 6.1, 6.0
Reviewed-on: https://review.typo3.org/18529
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack

index f82e85b..6779efc 100644 (file)
@@ -191,9 +191,12 @@ class ProcessedFile extends AbstractFile {
                        throw new \RuntimeException('Cannot update original file!', 1350582054);
                // TODO this should be more generic (in fact it only works for local file paths)
-               $this->storage->addFile($filePath, $this->storage->getProcessingFolder(), $this->name, 'replace');
+               $addedFile = $this->storage->addFile($filePath, $this->storage->getProcessingFolder(), $this->name, 'replace');
                // Update some related properties
+               $this->identifier = $addedFile->getIdentifier();
                $this->originalFileSha1 = $this->originalFile->getSha1();
+               $this->updateProperties($addedFile->getProperties());
                $this->deleted = FALSE;
                $this->updated = TRUE;