Bug #88455
closedNever attach random string if file already exists in folder
100%
Description
\TYPO3\CMS\Core\Utility\File\BasicFileUtility::getUniqueName
The inner condition never can be reached if $a equals $this->maxNumber. Result is, that "then we try unique-strings" never can be executed
for ($a = 1; $a < $this->maxNumber; $a++) {
if ($a <= $this->maxNumber) {
// First we try to append numbers
$insert = '_' . sprintf('%02d', $a);
} else {
// .. then we try unique-strings...
$insert = '_' . substr(md5(uniqid('', true)), 0, $this->uniquePrecision);
}
Working Code
for ($a = 1; $a <= $this->maxNumber; $a++) {
if ($a < $this->maxNumber) {
// First we try to append numbers
$insert = '_' . sprintf('%02d', $a);
} else {
// .. then we try unique-strings...
$insert = '_' . substr(md5(uniqid('', true)), 0, $this->uniquePrecision);
}
The change was made in 30282eef79e069fe78ea39e53df2fc003bc6c2f4 [!!!][TASK] Cleanup and remove old filefunc logic on 2016-01-08 by Benni Mack
Updated by Georg Ringer over 5 years ago
- Related to Task #76257: Cleanup and remove old filefunc logic added
Updated by Gerrit Code Review over 5 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60885
Updated by Georg Ringer over 5 years ago
- Is duplicate of Bug #88332: incorrect generation of unique file name in BasicFileUtility added
Updated by Georg Ringer over 5 years ago
- Status changed from Under Review to Closed
Thanks for your report! I am fixing this with issue #88455 and therefore closing this one as duplicate.
Updated by Stephan Großberndt over 5 years ago
- Status changed from Closed to Under Review
Updated by Gerrit Code Review over 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61179
Updated by Georg Ringer over 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset a77d11aecd6c13f081713f6e18e4b427a6e80c78.
Updated by Gerrit Code Review over 5 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61536
Updated by Georg Ringer about 5 years ago
- Status changed from Under Review to Resolved
Applied in changeset 95718dd29e5fcee3cc8ecdc077d1326c411667bd.
Updated by Benni Mack almost 5 years ago
- Status changed from Resolved to Closed