New issue
Advanced search Search tips

Issue 728937 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

Pasting text from Word 2016 on macOS includes transparent PNG in the DataTransfer object when no image was copied

Reported by mich...@mbates.co, Jun 2 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

Steps to reproduce the problem:
1. Copy any plain text from Word 2016
2. Setup a page to get the output of event.clipboardData.files in a 'paste' event handler
3. The files array will contain one File, even though none was copied from Word 2016

What is the expected behavior?
The files array should be empty as no image was copied

What went wrong?
This only happens on macOS. Tested on Firefox and Safari and the result is the expected behaviour (empty files array). See here for an example fiddle: https://jsfiddle.net/9gnoxhng/1/

Did this work before? N/A 

Chrome version: 58.0.3029.110  Channel: stable
OS Version: OS X 10.12.4
Flash Version:
 
Components: -Blink Blink>DataTransfer
Status: Untriaged (was: Unconfirmed)
Labels: Needs-Triage-M58
What are the properties of the file? (type, size, content, ... ?)


Comment 4 by mich...@mbates.co, Jun 6 2017

According to the logged FileList array in the provided fiddle, these are the properties:

lastModified: 1496708737117
lastModifiedDate: Tue Jun 06 2017 10:25:37 GMT+1000 (AEST)
name: "image.png"
size: 307
type: "image/png"
webketRelativePath: ""

The size seems to increase as more text is pasted (I just pasted a blank space from Word and got size 307, if I paste  a sentence such as "This is a test" the size is 788.

lastModified and lastModifiedDate are the current date and time when the text is pasted.
I wonder what the image is - maybe Word is putting a screenshot of the doc on the pasteboard! (Sorry, don't have MacOS+Word handy to test myself at the moment)

Comment 6 by mich...@mbates.co, Jun 6 2017

Looks like you are correct, this updated fiddle creates an <img> object with the src set to the data url of the pasted file object.

The image contains the text that was just pasted. I wonder why this doesn't happen on Windows?

https://jsfiddle.net/9gnoxhng/2/
Cc: bsittler@chromium.org pwnall@chromium.org
+pwnall@chromium.org - can you attempt to reproduce this on a Mac?
Labels: -Pri-2 Pri-3
Status: Available (was: Untriaged)
I got this with Word 2011 (14.7.4) and Word 2016 (15.34). 

I tried copy-pasting "Some random text in a sentence." Office 2011 creates a 1397-byte file, Office 2016 creates a 1421-byte file. I'm guessing we do this because we see an image on the clipboard, and our heuristics decide we should add an image file. FWIW, Firefox 53.0.3 and Safari TP 31 don't do this.

I've attached the pasteboard types as shown by Clipboard Viewer at https://developer.apple.com/library/content/samplecode/ClipboardViewer/Introduction/Intro.html
office.14.png
318 KB View Download
office.15.png
204 KB View Download
Project Member

Comment 9 by sheriffbot@chromium.org, Jun 8 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: -bsittler@chromium.org
Status: Available (was: Untriaged)
Still repros on Chrome 69.0.3464.0 with Word 16.14.1.

Sign in to add a comment