#107624Last possible name "image_060388.jpg" is already taken. 1325194291
Description
Hey,
it seems that the mechanism in FAL to create unique file names fails earlier than expected.
In systems where users upload images without a specific file name, where a generic file name is taken, the probability to encounter that exception is a lot higher than in scenarios where users choose their own file names.
The first 100 names are quickly taken ( image.jpg … image_99.jpg ). Then, a rather small (6 characters) sub string of a unique string is added. That’s 2.176.782.336 possible values in theory, running an endless while loop creating random file names, I rather quickly encountered the exception.
It took only 9700 files until I hit that exception, 3000 runs more until I hit the next. On a prod system I hit it after about 700 files.
My suggestion is to increase the number of random characters that are appended. Even a single character increases the amount of possibilities from 2.176.782.336 to 78.364.164.096 . That’s 76 billion (german Milliarden) more.
I suggest using an 8 or even 10 character wide sub string. The probability for a collision is extremely small then.
Reviews 1
History 24
-
Gerrit Code Review pushed patch set 2 for main to change 90948 status
NewUnder Review 10/07/25, 15:45 -
Gerrit Code Review pushed patch set 3 for main to change 90948 10/07/25, 16:00
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % 10/10/25, 20:40 -
Benni Mack changed status
ResolvedClosed 12/02/25, 13:04
Applied in changeset commit:f0282deb814815d114cf5048273516bcb5da12b7.