Project

General

Profile

Actions

Bug #54357

closed

Inconsistent usage of filename sanitation

Added by Alexander Stehlik over 10 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2013-12-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

How would you solve this:

Before I create a file I check if the file exists in the folder where I want to create it:

\TYPO3\CMS\Core\Resource\Folder->hasFile()
\TYPO3\CMS\Core\Resource\ResourceStorage->hasFileInFolder()
\TYPO3\CMS\Core\Resource\Driver\AbstractDriver->fileExistsInFolder()

To add a file I use:

\TYPO3\CMS\Core\Resource\Folder->addFile()
\TYPO3\CMS\Core\Resource\ResourceStorage->addFile()
\TYPO3\CMS\Core\Resource\Driver\AbstractDriver->addFile()

The problem here is, that AbstractDriver->hasFile() will not call AbstractDriver->sanitizeFileName() before checking if the file exists, but add AbstractDriver->addFile() will do.

This will lead to the problem that addFile() can fail because the sanitized filename exists in the folder but not the file that was checked in the first place.

So basically I see two options:

  1. Make the sanitizeFilename() method publicly available (by changing the getDriver() in the ResourceStorage class to public and let the developers perform the sanitation manually or
  2. Add the sanitizeFileName() check to AbstractDriver->fileExistsInFolder()

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #55299: conflictMode rename is not working when uploading file with umlautClosed2014-01-24

Actions
Related to TYPO3 Core - Task #68600: Change ResourceStorage::processUploadedFilename to sanitizeFileNameClosedFrans Saris2015-07-28

Actions
Actions

Also available in: Atom PDF