fix: [eventGraph] Request picture for valid attachement only

pull/5668/head
mokaddem 2020-02-21 14:42:20 +01:00
parent 782ba603c5
commit 49ef787a34
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 8 additions and 2 deletions

View File

@ -766,7 +766,7 @@ class EventGraph {
group: group,
mass: 5,
};
if (node.type == 'attachment') {
if (node.type == 'attachment' && isPicture(node.value)) {
// fetch picture via attributes/viewPicture
node_conf.group = 'attribute_image';
node_conf.size = $('#slider_display_picture_size').val();
@ -1018,7 +1018,7 @@ class EventGraph {
color: getTextColour(parent_color)
}
};
if (attr.type == 'attachment') {
if (attr.type == 'attachment' && isPicture(attr.value)) {
// fetch picture via attributes/viewPicture
node.group = 'obj_relation_image';
node.size = $('#slider_display_picture_size').val();
@ -2501,3 +2501,9 @@ function global_processProperties(clusterOptions, childNodes) {
that.clusters.push({id:'cluster:' + that.cluster_index, scale: that.cur_scale, group: clusterOptions.group});
return clusterOptions;
}
function isPicture(filename) {
var extension = filename.split('.').pop()
var validExtensions = ['jpg', 'jpeg', 'png', 'gif']
return validExtensions.includes(extension)
}