Skip to content

Commit

Permalink
Fix #2384 issue
Browse files Browse the repository at this point in the history
Handle ';' in layer_title.
Use fallback for undefined titles.
  • Loading branch information
metehaansever committed Jan 7, 2025
1 parent 8fbd071 commit 30ef0d1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions anvio/data/interactive/js/drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,20 @@ Drawer.prototype.generate_tooltips = function() {
{
var pindex = this.settings['layer-order'][i];
var layer_title = layerdata[0][pindex];
if (layer_title.indexOf('!') > -1)
layer_title = layer_title.split('!')[0];

if (layer_title) {
if (layer_title.indexOf('!') > -1) {
layer_title = layer_title.split('!')[0];
}
if (layer_title.indexOf(';') > -1) {
console.warn(`Unexpected character ';' found in layer title: ${layer_title}`);
layer_title = layer_title.replace(/;/g, '');
}
} else {
console.warn(`Layer title is undefined for index: ${pindex}`);
layer_title = 'Unknown';
}

empty_tooltip += '<tr><td>' + layer_title + '</td><td>n/a</td></tr>';
}

Expand Down

0 comments on commit 30ef0d1

Please sign in to comment.