Firefox has quirky copy/paste image behavior

How to repro. Firefox Only (latest)

  1. Open any image from imgur/imageshack etc…
  2. Copy Image. (Do not copy image URL/Just copy image)
  3. Paste the image on your latest upgraded Discourse community, Instead of uploading the image, the link of the image gets copied.

On Chrome you get the image uploaded to the community. Firefox latest image upload does not take place.

When I right-click “Copy Image” using Firefox, it does not enable the right-click paste option.

But control-v works

I’ve always thought it was a Firefox issue (i.e. clipboard), not a Discourse issue

Copy - Paste text works fine.

1 Like

Control + V works to paste the image, that’s what i have been doing and i loved this feature it was awesome and time saving.

But it just copies the image url, not upload it. For example try pasting this image below
https://i.imgur.com/1Cw4eDI.jpg

The result would be

<img src='https://i.imgur.com/1Cw4eDI.jpg'>

As you can see it did copy the image URL, Instead of uploading the image. (On chrome it uploads the image to the discourse)

Edit - Sorry about my English.

Pretty sure this is by design. Firefox image pasting looks pretty difficult to deal with, so this is the team’s best effort. See the relevant comment in the code here:

https://github.com/discourse/discourse/blob/3df2ee343154e78f8490a418df08656323c993b0/app/assets/javascripts/discourse/components/composer-editor.js.es6#L276

2 Likes

Right-click “copy image” followed by Ctrl+V pasting works fine for me on Firefox. (44.0.2 on Ubuntu Gnome 15.10).

However, as of this afternoon, I no longer seem to be able to use drag-and-drop image upload in Firefox, either here or on SitePoint. Firefox updated this morning, so that’s probably when the change occurred.

it did not work because the image you posted was not uploaded to meta.discourse.org
https://pixabay.com/static/uploads/photo/2016/01/30/17/41/africa-1170108_960_720.jpg
This is the image link.

My apologies - I had misunderstood the issue.

@eviltrout can you check next week and make sure we didn’t have any regressions here?

I tried on the latest Firefox on try.discourse.org and it seems to be working fine? Perhaps it’s an issue with the particular image that was tried.

2 Likes

But this seems to be doing what the elephant picture did (above) and linking to pixabay, rather than uploading to Discourse. (And the original report was using images on imgur, so it seems not to be the image or the site.)

Firefox 44.0.2 on Ubuntu Gnome 15.10.

You’re sure you’re using right click, Copy Image?

I just tried again to make sure. Curiously that didn’t copy the image when I did it in Firefox, it copied a URL to it, but it still worked.

I also tried with a larger image. It took a while to upload, but it did finish and then Firefox told me the image was too large to upload.

2 Likes

But that’s the reported bug; “copy image” and paste is behaving exactly as “copy image location” and paste; it isn’t uploading the image to Discourse.

(I don’t generally use this method with Discourse, so can’t say whether this is a recent issue or not.)

3 Likes

Wow now I feel dumb! That is interesting and perhaps out of our control. I will check it out.

3 Likes

This is not something that is easy to change.

  • If there is an image in the clipboard, copied from any other application, pasting in Firefox works fine.

  • If the image was copied in Firefox using Copy Image, pasting no longer gives our application the data that we can parse, and only gives us the URL.

I think Discourse is doing the right thing in this case. Since it doesn’t have the image data to upload, it inserts the URL in the document as if that was copied and pasted.

6 Likes

I think something here is still broken, even within Discourse.

there is a .webp image in this post;

the full URL to the image is here, so its hosted on Discourse; https://d11a6trkgmumsb.cloudfront.net/original/4X/4/7/3/473600457bad5d0f8eb85689b40ca13507fac2bc.webp

note that this is an animated .webp image

However when I right click on the image in the Discourse page and Copy, then Paste into the onebox, I instead get a PNG which then gets converted by Discourse into the following JPG;

image

any thoughts? I am guessing this is not the intended behavior either?