Open Bug 1679026 Opened 4 years ago Updated 4 years ago

Copy-pasting image to Word causes blank box with "Keep source formattng" option

Categories

(Core :: DOM: Serializers, defect)

Firefox 84
x86_64
Windows 10
defect

Tracking

()

REOPENED

People

(Reporter: 1932809100, Unassigned)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36

Steps to reproduce:

  1. open pixiv.net
    2.choose a jpg image
    3.copy this image
    4.paste it to somewhere else, like a word document

Actual results:

The pasted jpg image is completely blank.

Expected results:

The pasted image should show correctly.

OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64

[Tracking Requested - why for this release]:

Attachment #9189488 - Attachment description: QQ图片20201123235126.png → When I copy this image file to word document, it becomes completely blank.
Component: Untriaged → General

I'm not able to reproduce this. I tried opening a jpeg from pixiv.net in a new tab and then copying it, and also copying an image shown on the page. Could you please provide specific steps to reproduce the problem?

Flags: needinfo?(1932809100)

(In reply to Drew Willcoxon :adw from comment #3)

I'm not able to reproduce this. I tried opening a jpeg from pixiv.net in a new tab and then copying it, and also copying an image shown on the page. Could you please provide specific steps to reproduce the problem?

That seems very strange. For me, this problem happens on Firefox version 83 and version 84. I can reproduce this problem every time when I copy a jpg image from pixiv.net, both shown on the page or in a new tab.
Have you tried to paste the jpg image to a new Microsoft Word document? There are two paste options for images: keep source formatting and picture. This problem happens when you choose to keep source formatting. If you choose to copy it as picture, every thing goes fine.

Flags: needinfo?(1932809100)

(In reply to Drew Willcoxon :adw from comment #3)

I'm not able to reproduce this. I tried opening a jpeg from pixiv.net in a new tab and then copying it, and also copying an image shown on the page. Could you please provide specific steps to reproduce the problem?

Sorry I had a spelling mistake on comment #4. If you choose to paste it as picture, it goes fine.

I was also unable to reproduce this issue. Do you see this for other sites or only pixiv.net? Can you only reproduce this issue when pasting into a word doc?

Flags: needinfo?(1932809100)
Product: Firefox → Core

(In reply to Emma Malysz from comment #6)

I was also unable to reproduce this issue. Do you see this for other sites or only pixiv.net? Can you only reproduce this issue when pasting into a word doc?

I found this issue for pixiv.net. This issue not only happen when pasting into a microsoft office doc (word and powerpoint), but also happens when pasting into a tencent qq chat page. I guess this happens when pasting with keeping source formatting.

Flags: needinfo?(1932809100)

(In reply to Emma Malysz from comment #6)

I was also unable to reproduce this issue. Do you see this for other sites or only pixiv.net? Can you only reproduce this issue when pasting into a word doc?
Yes. I only found this with pixiv.net.

(In reply to Emma Malysz from comment #6)

I was also unable to reproduce this issue. Do you see this for other sites or only pixiv.net? Can you only reproduce this issue when pasting into a word doc?

Perhaps another way to reproduce the issue: copy a jpg image from pixiv.net, create a new folder, then paste the image into the folder. It would be saved as jpg file. However, if you do so, the jpg file is broken.
I only found this issue with pixiv.net.

Component: General → DOM: Serializers

Attached image This is an example of the copied jpg image file from pixiv.net. For some unknown reasons, it's broken. — Details

This file is an HTML containing a "403 Forbidden" message.

Attachment #9189489 - Attachment mime type: image/jpeg → text/html

I reproduce this bug, but copying from Chrome also works as same as Firefox.

If I paste it into a contenteditable element, e.g., data:text/html,<div contenteditable><br></div>, I see only the alt-text and I see 403 error in the console. So, I guess that pixiv does not allow to load their content in other web pages, native apps, etc. So, I bet this is INVA. (I think that Word's pasting with keeping original format means that you paste it as HTML fragment whose <img> refers the original image directly.)

Mirko, any ideas?

Flags: needinfo?(mbrodesser)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Got a cold, working slower) from comment #11)

I reproduce this bug, but copying from Chrome also works as same as Firefox.

If I paste it into a contenteditable element, e.g., data:text/html,<div contenteditable><br></div>, I see only the alt-text and I see 403 error in the console. So, I guess that pixiv does not allow to load their content in other web pages, native apps, etc. So, I bet this is INVA. (I think that Word's pasting with keeping original format means that you paste it as HTML fragment whose <img> refers the original image directly.)

Mirko, any ideas?

This does not work with Chrome, if the image is not already cached. When it's not cached, a 403 error is logged, otherwise not. This can be reproduced for instance with https://www.pixiv.net/en/artworks/86743291. With Firefox, the 403 error is logged, even if the image is already cached. It seems, this a bug of Firefox's cache.

Reproducible on Ubuntu 18.04.

Component: DOM: Serializers → Networking: Cache
Flags: needinfo?(mbrodesser)

(In reply to Mirko Brodesser (:mbrodesser) from comment #12)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Got a cold, working slower) from comment #11)

I reproduce this bug, but copying from Chrome also works as same as Firefox.

If I paste it into a contenteditable element, e.g., data:text/html,<div contenteditable><br></div>, I see only the alt-text and I see 403 error in the console. So, I guess that pixiv does not allow to load their content in other web pages, native apps, etc. So, I bet this is INVA. (I think that Word's pasting with keeping original format means that you paste it as HTML fragment whose <img> refers the original image directly.)

Mirko, any ideas?

This does not work with Chrome, if the image is not already cached. When it's not cached, a 403 error is logged, otherwise not. This can be reproduced for instance with https://www.pixiv.net/en/artworks/86743291. With Firefox, the 403 error is logged, even if the image is already cached. It seems, this a bug of Firefox's cache.

Reproducible on Ubuntu 18.04.

Not sure if I understand the 403 error you mean. Here is what I tested:

  1. Open https://www.pixiv.net/en/artworks/86743291.
  2. Copy the image uri (https://i.pximg.net/img-master/img/2021/01/02/00/25/49/86743291_p0_master1200.jpg) of the image.
  3. Open another tab with the image uri.
  4. I see 403 Forbidden.

I think the 403 error is caused by privacy.partition.network_state being true. Apparently, the server doesn't allow to download the image directly. If you turn off privacy.partition.network_state, you can see the content of https://i.pximg.net/img-master/img/2021/01/02/00/25/49/86743291_p0_master1200.jpg severed from cache.

However, if I turn off privacy.partition.network_state, I still can't paste the image to other apps. Since I am using osx, I tried to paste the image to Pages. It seems that Brave browser works fine, but Firefox doesn't no matter if privacy.partition.network_state is enabled or not.
Since I can't find anything wrong regarding to cache, I'd like to bounce the component back to DOM: Serializers.

Component: Networking: Cache → DOM: Serializers

(In reply to Kershaw Chang [:kershaw] from comment #13)

(In reply to Mirko Brodesser (:mbrodesser) from comment #12)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Got a cold, working slower) from comment #11)

I reproduce this bug, but copying from Chrome also works as same as Firefox.

If I paste it into a contenteditable element, e.g., data:text/html,<div contenteditable><br></div>, I see only the alt-text and I see 403 error in the console. So, I guess that pixiv does not allow to load their content in other web pages, native apps, etc. So, I bet this is INVA. (I think that Word's pasting with keeping original format means that you paste it as HTML fragment whose <img> refers the original image directly.)

Mirko, any ideas?

This does not work with Chrome, if the image is not already cached. When it's not cached, a 403 error is logged, otherwise not. This can be reproduced for instance with https://www.pixiv.net/en/artworks/86743291. With Firefox, the 403 error is logged, even if the image is already cached. It seems, this a bug of Firefox's cache.

Reproducible on Ubuntu 18.04.

Not sure if I understand the 403 error you mean. Here is what I tested:

  1. Open https://www.pixiv.net/en/artworks/86743291.
  2. Copy the image uri (https://i.pximg.net/img-master/img/2021/01/02/00/25/49/86743291_p0_master1200.jpg) of the image.
  3. Open another tab with the image uri.
  4. I see 403 Forbidden.

I think the 403 error is caused by privacy.partition.network_state being true. Apparently, the server doesn't allow to download the image directly. If you turn off privacy.partition.network_state, you can see the content of https://i.pximg.net/img-master/img/2021/01/02/00/25/49/86743291_p0_master1200.jpg severed from cache.

However, if I turn off privacy.partition.network_state, I still can't paste the image to other apps. Since I am using osx, I tried to paste the image to Pages. It seems that Brave browser works fine, but Firefox doesn't no matter if privacy.partition.network_state is enabled or not.
Since I can't find anything wrong regarding to cache, I'd like to bounce the component back to DOM: Serializers.

I wasn't aware of privacy.partition.network_state. It seems Chrome doesn't support something analogous. Note that copying the image (right click -> "Copy Image") and copying the image URI need to be distinguished. The former creates a clipboard flavor "image/jpeg" (on Ubuntu, at least) which contains the binary data for the image and a "text/html" flavor which contains:

$ xclip -t text/html -o
<meta http-equiv="content-type" content="text/html; charset=utf-8"><img alt="original, new year’s card, girl / 2021" src="https://i.pximg.net/img-master/img/2021/01/02/00/25/49/86743291_p0_master1200.jpg" srcset="https://i.pximg.net/c/540x540_70/img-master/img/2021/01/02/00/25/49/86743291_p0_master1200.jpg 540w,https://i.pximg.net/img-master/img/2021/01/02/00/25/49/86743291_p0_master1200.jpg" style="height: 646px;" class="sc-1qpw8k9-1 fvHoJ" width="777" height="1125">

The receiving app (e.g. Microsoft Word) decides which flavor to use. Pasting to Libre Office Writer works and xclip -t image/jpeg -o > x.jpeg too, so this is not a Serializer bug. At least on Ubuntu.

I presume Microsoft Word doesn't read "image/jpeg", but "text/html".

:kershaw: can you please check whether copying the image (as mentioned above) from Chrome to Pages works on OSX?

(In reply to Mirko Brodesser (:mbrodesser) from comment #14)

(In reply to Kershaw Chang [:kershaw] from comment #13)

(In reply to Mirko Brodesser (:mbrodesser) from comment #12)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Got a cold, working slower) from comment #11)

I reproduce this bug, but copying from Chrome also works as same as Firefox.

If I paste it into a contenteditable element, e.g., data:text/html,<div contenteditable><br></div>, I see only the alt-text and I see 403 error in the console. So, I guess that pixiv does not allow to load their content in other web pages, native apps, etc. So, I bet this is INVA. (I think that Word's pasting with keeping original format means that you paste it as HTML fragment whose <img> refers the original image directly.)

Mirko, any ideas?

This does not work with Chrome, if the image is not already cached. When it's not cached, a 403 error is logged, otherwise not. This can be reproduced for instance with https://www.pixiv.net/en/artworks/86743291. With Firefox, the 403 error is logged, even if the image is already cached. It seems, this a bug of Firefox's cache.

Reproducible on Ubuntu 18.04.

Not sure if I understand the 403 error you mean. Here is what I tested:

  1. Open https://www.pixiv.net/en/artworks/86743291.
  2. Copy the image uri (https://i.pximg.net/img-master/img/2021/01/02/00/25/49/86743291_p0_master1200.jpg) of the image.
  3. Open another tab with the image uri.
  4. I see 403 Forbidden.

I think the 403 error is caused by privacy.partition.network_state being true. Apparently, the server doesn't allow to download the image directly. If you turn off privacy.partition.network_state, you can see the content of https://i.pximg.net/img-master/img/2021/01/02/00/25/49/86743291_p0_master1200.jpg severed from cache.

However, if I turn off privacy.partition.network_state, I still can't paste the image to other apps. Since I am using osx, I tried to paste the image to Pages. It seems that Brave browser works fine, but Firefox doesn't no matter if privacy.partition.network_state is enabled or not.
Since I can't find anything wrong regarding to cache, I'd like to bounce the component back to DOM: Serializers.

I wasn't aware of privacy.partition.network_state. It seems Chrome doesn't support something analogous. Note that copying the image (right click -> "Copy Image") and copying the image URI need to be distinguished. The former creates a clipboard flavor "image/jpeg" (on Ubuntu, at least) which contains the binary data for the image and a "text/html" flavor which contains:

Right, I know that copying the image URI is not the same as copying the image, but this is the only way I saw the 403 error. Could you explain more why you think 403 response cached is related to pasting data to the receiving app?

The receiving app (e.g. Microsoft Word) decides which flavor to use. Pasting to Libre Office Writer works and xclip -t image/jpeg -o > x.jpeg too, so this is not a Serializer bug. At least on Ubuntu.

I presume Microsoft Word doesn't read "image/jpeg", but "text/html".

:kershaw: can you please check whether copying the image (as mentioned above) from Chrome to Pages works on OSX?

Copying image from Chrome to Pages works on my laptop.

Flags: needinfo?(kershaw)

Thanks, :kershaw. On Windows 10, pasting to Microsoft WordPad works, but pasting to Microsoft Word doesn't. So that's a bug of the latter. It doesn't work when pasting from Chrome either.

:kershaw: just to be sure, can you please check whether "Copy image" (not copying the URI) from Firefox to Pages works?

(In reply to Mirko Brodesser (:mbrodesser) from comment #16)

Thanks, :kershaw. On Windows 10, pasting to Microsoft WordPad works, but pasting to Microsoft Word doesn't. So that's a bug of the latter. It doesn't work when pasting from Chrome either.

:kershaw: just to be sure, can you please check whether "Copy image" (not copying the URI) from Firefox to Pages works?

No, copying image from Firefox to Pages doesn't work.

Flags: needinfo?(kershaw)

I looked at this as well on macOS. Both Chrome and Firefox appear to successfully get the image in the clipboard (I inspect that in Finder, through Edit -> Show Clipboard), but only the image copied in Chrome can be pasted into a Pages document. (When copying from Firefox the paste command in Pages hangs a bit and then nothing happens.)

That does make me think this is unrelated to network partitioning.

(In reply to Anne (:annevk) from comment #18)

I looked at this as well on macOS. Both Chrome and Firefox appear to successfully get the image in the clipboard (I inspect that in Finder, through Edit -> Show Clipboard), but only the image copied in Chrome can be pasted into a Pages document. (When copying from Firefox the paste command in Pages hangs a bit and then nothing happens.)

That does make me think this is unrelated to network partitioning.

Thanks.

Pasting the image to "Preview" (File -> New from Clipboard) works on OSX 10.13.6. "Pages" requires a newer OSX version, so I can't test that.
Since this works for "Preview" on OSX and for "WordPad" on Windows, "Pages" and "Word" seem to be buggy. Closing this bug as invalid. It could be worth to file bugs for "Word" and "Pages".

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID

I don't think that's the correct resolution here as this works in Chrome. We should figure out what we do differently.

Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---

Summary from some Matrix-chat discussion with :annevk: current suspicion is that "Pages" relies on the ordering of the different clipboard-flavors and Chrome and Firefox could potentially create a different ordering.

Same happens when copy-pasting MDN example image to Word. Changing title as such.

Mixing Word and Pages issues here is confusing, could we file another one for Pages? Word does not accept images from Chrome either at least on Windows.

Edit: By Word I mean the native Windows app, not the online one.

Severity: -- → S3
Summary: jpg image copy problem with pixiv.net → Copy-pasting image to Word causes blank box with "Keep source formattng" option
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: