Hello all,
When adding an image in a page, if an attachment with a similar name already exists, the attachment is replaced by the new image (with an version increment).
But, for images pasted in CKEditor, the user does not control the image name.
The image name is a localized and browser dependent constant (e.g., image.png
on Chrome, or grafik.png
in a German Firefox).
Consequently, if a user paste several images to the same document, the last one will override the previous one (or if an image.png
image already exists).
The current approach to address this issue is to check if the image is named image.png
and to replace it with ${TIMESTAMP}-${RANDOM}.png
.
But, as explained above, this is not accurate as for German Firefox, the file name is grafik.png
.
You can see the Draft PR where I propose an approach to more accurately identify if an image originates from a paste operation (using beforePaste/afterPaste
event listeners).
This PR is also proposing a behavioral change. The pasted filename is now transformed to ${FILENAME}-${TIMESTAMP}-${RANDOM}.png
where FILENAME
is the original name of the pasted file (e.g, image
or grafik
).
This change is not technically required and we could keep using the ${TIMESTAMP}-${RANDOM}.png
pattern, but I feel like having the original filename could make for better attachments names.
So the question is, WDYT of changing the filename pattern:
- in 15.x?
- in 14.10.x?