From eb03ee3cda8d1a6c9a10bd7e2db2e13d26e20dc5 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Tue, 22 Mar 2022 06:58:20 +0000 Subject: Merged r21463 to 4.1-stable (#36013). git-svn-id: https://svn.redmine.org/redmine/branches/4.1-stable@21494 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- public/javascripts/attachments.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index f5d2f727b..b5173c067 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -259,11 +259,10 @@ function copyImageFromClipboard(e) { if (!clipboardData) { return; } if (clipboardData.types.some(function(t){ return /^text\/plain$/.test(t); })) { return; } - var items = clipboardData.items - for (var i = 0 ; i < items.length ; i++) { - var item = items[i]; - if (item.type.indexOf("image") != -1) { - var blob = item.getAsFile(); + var files = clipboardData.files + for (var i = 0 ; i < files.length ; i++) { + var file = files[i]; + if (file.type.indexOf("image") != -1) { var date = new Date(); var filename = 'clipboard-' + date.getFullYear() @@ -272,9 +271,8 @@ function copyImageFromClipboard(e) { + ('0'+date.getHours()).slice(-2) + ('0'+date.getMinutes()).slice(-2) + '-' + randomKey(5).toLocaleLowerCase() - + '.' + blob.name.split('.').pop(); - var file = new Blob([blob], {type: blob.type}); - file.name = filename; + + '.' + file.name.split('.').pop(); + var inputEl = $('input:file.filedrop').first() handleFileDropEvent.target = e.target; addFile(inputEl, file, true); -- cgit v1.2.3