Project

General

Profile

Defect #36013 » 0001-Fix-for-36013.patch

Marius BĂLTEANU, 2022-02-27 15:01

View differences:

public/javascripts/attachments.js
275 275
  if (!clipboardData) { return; }
276 276
  if (clipboardData.types.some(function(t){ return /^text\/plain$/.test(t); })) { return; }
277 277

  
278
  var items = clipboardData.items
279
  for (var i = 0 ; i < items.length ; i++) {
280
    var item = items[i];
281
    if (item.type.indexOf("image") != -1) {
282
      var blob = item.getAsFile();
278
  var files = clipboardData.files
279
  for (var i = 0 ; i < files.length ; i++) {
280
    var file = files[i];
281
    if (file.type.indexOf("image") != -1) {
283 282
      var date = new Date();
284 283
      var filename = 'clipboard-'
285 284
        + date.getFullYear()
......
288 287
        + ('0'+date.getHours()).slice(-2)
289 288
        + ('0'+date.getMinutes()).slice(-2)
290 289
        + '-' + randomKey(5).toLocaleLowerCase()
291
        + '.' + blob.name.split('.').pop();
292
      var file = new Blob([blob], {type: blob.type});
293
      file.name = filename;
290
        + '.' + file.name.split('.').pop();
291

  
294 292
      var inputEl = $('input:file.filedrop').first()
295 293
      handleFileDropEvent.target = e.target;
296 294
      addFile(inputEl, file, true);
(2-2/3)