Inserting an image from the clipboard filename does not get a timestamp

Hardy May 12, 2022

Since Confluence version 7.17, inserting images via the clipboard no longer works correctly. The image does not get a timestamp in the file name. This leads to the fact that a second inserted image gets the same file name (always grafik.png) and overwrites the first image. There is also no error message that the filename already exists.
Before version 7.17 images always got a filename in the form imageYYY-MM-DD_HH-MM-SS.png.
Possibly it is a problem of the translation. We use german

2 answers

1 accepted

0 votes
Answer accepted
Hardy May 12, 2022

We using Confulence Version 7.17.2 self hosted Server.

We use Firefox 100. The image name is always grafik.png.

Now i treid with the Chrome Browser Version 101.0.4951.64 and here I get a correct file name with timestamp e.g. image2022-5-12_10-50-39.png

There seems to be a problem with the new Firefox version.

 

Peter Ovenhausen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 13, 2022

We are using Confluence Version 7.17.4 and have the same problem.

If we use the same Firefox version and do the clipboard insertion (with CTRL-V) at a Jira comment or the description field then a file is generated with a unique filename.
This indicates for me that there is a problem with Confluence working together with the current Firefox version.

Hardy June 14, 2022

I have found the error. In newer Firefox versions, the filename has now been translated for Copy&Paste.

In older Firefox versions the name image.png was transmitted when inserting an image. In newer Firefox versions image.png was translated to grafik.png.

Therefore grafik.png does not match with image.png as specified in the javascript.

The javascript checks for image.png and then inserts the timestamp:

Here is the code:
if(e.name&&"image.png"!=e.name)o=e.name;else{var c=r?"-".concat(r):"";o="image".concat(i.getFullYear(),"-").concat(a,"-").concat(i.getDate(),"_"). concat(i.getHours(),"-").concat(i.getMinutes(),"-").concat(i.getSeconds()).concat(c,".png")}return{fileName:o,fileSize:t,slice:function(t,n){

Solution would be to insert in translation (global default languages) grafik.png for german and accordingly for other languages and then consider this translation with or expression in the javascript.

e.name&&("image.png"||"grafik.png")

 

 

 

Like Peter Ovenhausen likes this
Support July 18, 2022

We can also confirm the image-insert-from-clipboard-bug exists for Atlassian Confluence 7.18.1. Server Edition and also running a german instance.

The error is however not omnipresent.

It's present for one user, but not for another. Same setup (latest OS+Firefox 102.0.1), so it's weird.

Possible Workarounds:

1.) Save the images separetly and import them via makro

2.) Work with EDGE

The workaround are possible, but not elegant.

Is solely Firefox to blame??

Hardy July 20, 2022

It's because of the translation in Firefox. When pasting from the clipboard, the browsers provide a name for the image. Chrome, Edge etc. deliver image.png. In Firefox someone came up with the idea to translate this name in the German version from image.png to garfik.png. So the javascript in confluence / jira etc. can't match and therefore can't insert a timestamp. I assume that this translation is also done in other languages and is not only a problem of the German version.

Solution would be to insert in translation (global default languages) grafik.png for german and accordingly for other languages and then consider this translation with or expression in the javascript.

e.name&&("image.png"||"grafik.png")

Oliver Fitz July 23, 2022

Making this dependent on the localization of dozens of languages might not be a good idea as it can change unexpectedly in any language again. Additionally, we don't even know if the localization was intentional on the Mozilla side or a mistake.

Given this difficult situation, resolving this probably won't be easy or quick.

Oliver Fitz July 23, 2022

Above, Hardy identified a JS snippet responsible for building the names with timestamps. Does anyone know where this is coming from? If yes, we would have the option to patch it in our installation ourselves! As Hardy pointed out, the fix for the one language we use (mostly german from what i see) is not that hard.

Like Ulrich Hinze likes this
Ulrich Hinze September 7, 2022

I'd be interested in where this java code is actually living, too! Any ideas how to find it?

0 votes
Oliver Fitz July 23, 2022

There is an official Jira issue for this by now:

https://jira.atlassian.com/browse/CONFSERVER-79517

The problem is caused by a recent Firefox localization change.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.17.2
TAGS
AUG Leaders

Atlassian Community Events