mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
fix to prevent uploging unexpected file type
This commit is contained in:
parent
b9fe4c5cd3
commit
f1801f9662
16880
package-lock.json
generated
Normal file
16880
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -51,6 +51,9 @@
|
|||||||
var files = ev.originalEvent.dataTransfer.files;
|
var files = ev.originalEvent.dataTransfer.files;
|
||||||
if (files.length === 1) {
|
if (files.length === 1) {
|
||||||
var file = files[0];
|
var file = files[0];
|
||||||
|
var name = file.name.toLowerCase();
|
||||||
|
|
||||||
|
if (name.match(/\.(apng|avif|gif|jpeg|png|svg|webp)$/)) {
|
||||||
var image = file2base64Image(file, function (image) {
|
var image = file2base64Image(file, function (image) {
|
||||||
var session = currentEditor.getSession();
|
var session = currentEditor.getSession();
|
||||||
var img = `<img src="${image}"/>\n`;
|
var img = `<img src="${image}"/>\n`;
|
||||||
@ -58,8 +61,11 @@
|
|||||||
session.insert(pos, img);
|
session.insert(pos, img);
|
||||||
$("#red-ui-image-drop-target").hide();
|
$("#red-ui-image-drop-target").hide();
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$("#red-ui-image-drop-target").hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user