Skip to content

Commit

Permalink
Fix bug in Copy Email Addresses button when there is no anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
campbell-m committed Aug 7, 2023
1 parent 6359fe8 commit 3c911b8
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions web/js/report.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,21 @@ function (result) {
var scheme = 'mailto:';
var message;
$.each(dt.column('#col_create_by').data(), function(index, value) {
var href = $(value).attr('href');
if ((href !== undefined) && href.startsWith(scheme))
{
var address = href.substring(scheme.length);
if ((address !== '') && !result.includes(address))
{
result.push(address);
try {
var href = $(value).attr('href');
if ((href !== undefined) && href.startsWith(scheme)) {
var address = href.substring(scheme.length);
if ((address !== '') && !result.includes(address)) {
result.push(address);
}
}
}
catch (error) {
<?php
// No need to do anything. This will catch the cases when $(value) fails because
// value is not a valid anchor element, and so we are not interested in it anyway.
?>
}
});
result.sort();
navigator.clipboard.writeText(result.join(', '))
Expand Down

0 comments on commit 3c911b8

Please sign in to comment.