Skip to content

Commit 43d7ace

Browse files
author
Pierre Vanliefland
committed
Merge pull request #29 from karobat/master
Fixed cache issue in uploading images with nameCallback set to slug
2 parents 01b5cc2 + 73a5f2c commit 43d7ace

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

Listener/FileSubscriber.php

+2-11
Original file line numberDiff line numberDiff line change
@@ -349,18 +349,9 @@ private function generateFileName($fileEntity, array $fileConfig)
349349
$filename = String::slugify($filename);
350350

351351
/*
352-
* Here we check if a file with the same name already exists
353-
* If yes then we run until a filename is not already used
352+
* Here we add a uniqid at the end of the filename to avoid any cache issue
354353
*/
355-
$i = 0;
356-
357-
do {
358-
$testFile = $filename . (0 === $i ? '' : '-'.$i);
359-
$i++;
360-
}
361-
while(file_exists($path . $testFile . $ext));
362-
363-
$filename = $testFile;
354+
$filename .= '-' . uniqid();
364355
}
365356
else {
366357
$filename = uniqid();

0 commit comments

Comments
 (0)