Project

General

Profile

Actions

Bug #57276

closed

Difference between creating and renaming a folder in filelist

Added by Tobias Wollender about 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-03-25
Due date:
% Done:

0%

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

Description

When I create a folder with spaces in the file list, e. g. "Test Folder" it gets saved and displayed with the space between the two words. When I then want to rename the folder into "Test Folder 2" it gets saved as "Test_Folder_2" - with underscores between the words. I think creating and renaming a folder should work the same way. Either maintain the spaces when renaming or replace them with underscores when creating. Tested with 6.2 RC2.

Actions #1

Updated by Sven Tappert over 9 years ago

I can confirm this (6.2.4, Linux & Win).

When renaming a file all spaces are converted to underscores. It's not possible to rename "My_Image" back to "My Image". If you try to, you will get error 'Destination "%s" existed already!'

White spaces in file pathes are not nice but should be accepted.

Actions #2

Updated by Sven Tappert over 9 years ago

Typo3 version 6.2.(3) replaces all characters that are not within [.a-zA-Z0-9_-] with a "_". This might be helpful in most cases but one should definitely be able to use whitespaces when renaming files manually, maybe with a "force" option.

When renaming (local) files there is a call to:
\TYPO3\CMS\Core\Resource\FolderInterface\LocalDriver::sanitizeFileName()

This function preg_replaces all forbidden characters with a "_", including the whitespace.

The matching pattern is stored in
\TYPO3\CMS\Core\Resource\FolderInterface\LocalDriver::UNSAFE_FILENAME_CHARACTER_EXPRESSION

It's a hex pattern and is set to '\\x00-\\x2C\\/\\x3A-\\x3F\\x5B-\\x60\\x7B-\\xBF'
The first range x00-x2C includes the whitespace (HexCode = x20).

I propose to exclude the whitespace from the pattern like this (but I'm not that experienced in regular expressions):
\\x00-\\x19\\x21-\\x2C\\/\\x3A-\\x3F\\x5B-\\x60\\x7B-\\xBF

Maybe a parameter should be added to the sanitizeFileName function to enable or disable whitespaces filtering.

Actions #3

Updated by Sven Tappert over 9 years ago

Alternatively, the call to filename "sanitization" could be omitted in \TYPO3\CMS\Core\Resource\ResourceStorage::renameFile()

Actions #4

Updated by Mathias Schreiber over 8 years ago

  • Status changed from New to Closed

works consistently on master

Actions

Also available in: Atom PDF