Added some datasheet filename sanitizing

master
assar 8 years ago
parent 42b31c4760
commit 5e307c4eef

@ -122,6 +122,10 @@ function save(partID) {
var data = new FormData(); var data = new FormData();
if (datasheet.length == 1) if (datasheet.length == 1)
if(! datasheet[0]['name'].match(/^[\w\-]+\.pdf$/g)) {
alert('Invalid filename. Please match /^[\w\-]+\.pdf$/g');
return;
}
data.append('datasheet-file', datasheet[0]); data.append('datasheet-file', datasheet[0]);
data.append('block', block_v); data.append('block', block_v);
data.append('type', type_v); data.append('type', type_v);

Loading…
Cancel
Save