Issue Bug Closed

#107624Last possible name "image_060388.jpg" is already taken. 1325194291

Alexander Schnitzler 10/07/25, 12:30 updated 12/02/25, 13:04

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