Project

General

Profile

Actions

Defect #36013

closed

Paste image mixed with other DataTransferItem

Added by Adrien Crivelli over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Attachments
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

It's been a few months that my Chrome (now Version 94.0.4606.81) cannot paste image when creating issue (with or without any Chrome extensions). I cannot reproduce with Firefox or not even Chromium. And I cannot pinpoint the reason why this problem started, but it has been consistently reproduced for months now, across multiple Chrome updates.

This is the JS error that occurs:

attachments.js?1591235575:275 Uncaught TypeError: Cannot read properties of null (reading 'name')
    at HTMLDivElement.copyImageFromClipboard (attachments.js?1591235575:275)
    at HTMLDivElement.dispatch (jquery-2.2.4-ui-1.11.0-ujs-5.2.3.js?1581467927:3)
    at HTMLDivElement.r.handle (jquery-2.2.4-ui-1.11.0-ujs-5.2.3.js?1581467927:3)

This is if I console.log(item) before the error occurs, for a single paste event:

DataTransferItem {kind: 'string', type: 'application/x-qt-image'}
DataTransferItem {kind: 'string', type: 'image/bmp'}
DataTransferItem {kind: 'string', type: 'image/cur'}
DataTransferItem {kind: 'string', type: 'image/ico'}
DataTransferItem {kind: 'string', type: 'image/jpeg'}
DataTransferItem {kind: 'string', type: 'image/jpg'}
DataTransferItem {kind: 'string', type: 'image/pbm'}
DataTransferItem {kind: 'string', type: 'image/pgm'}
DataTransferItem {kind: 'file', type: 'image/png'}     <== Only item that makes sense
DataTransferItem {kind: 'string', type: 'image/ppm'}
DataTransferItem {kind: 'string', type: 'image/xbm'}
DataTransferItem {kind: 'string', type: 'image/xpm'}

Attached is the patch to safely fix this. It applies on current git master (8075884bc48deb3b7af94799d6eba943e999dcb2), or svn r21243.


Files

paste-image-mixed-with-other-data-transfer-items.diff (570 Bytes) paste-image-mixed-with-other-data-transfer-items.diff Adrien Crivelli, 2021-10-19 02:51
0001-Fix-for-36013.patch (1.61 KB) 0001-Fix-for-36013.patch Marius BĂLTEANU, 2022-02-27 15:01
copy_image.png (51.9 KB) copy_image.png Yazan Al aeddin, 2022-03-02 11:26

Related issues

Related to Redmine - Defect #36887: copyImageFromClipboard function failed to generate a unique file nameClosedMarius BĂLTEANU

Actions
Actions

Also available in: Atom PDF