Firefox 在复制/粘贴图片方面行为古怪

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 个赞

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 个赞

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 个赞

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 个赞

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 个赞

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

3 个赞

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 个赞

我认为这里仍然有问题,即使是在 Discourse 中。

此帖子中有一个 .webp 图片;

图片的完整 URL 在这里,所以它托管在 Discourse 上; https://d11a6trkgmumsb.cloudfront.net/original/4X/4/7/3/473600457bad5d0f8eb85689b40ca13507fac2bc.webp

请注意,这是一个动画 .webp 图片

但是,当我右键单击 Discourse 页面上的图片并复制,然后粘贴到 onebox 中时,我得到的是一个 PNG,然后 Discourse 会将其转换为以下 JPG;

有什么想法吗?我猜这也不是预期的行为?