Skip to content

Commit

Permalink
only use the first title element for all datatables buttons (#4449)
Browse files Browse the repository at this point in the history
* only use the first title element

* fix security issue
  • Loading branch information
kristinmerbach committed Sep 10, 2024
1 parent 7543981 commit 9b00989
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ var _filename = function ( config, incExtension )
}

if ( filename.indexOf( '*' ) !== -1 ) {
filename = $.trim( filename.replace( '*', $('title').text() ) );
filename = $.trim( filename.replace( /\*/g, $('title').first().text() ) );
}

// Strip characters which the OS will object to
Expand Down Expand Up @@ -380,7 +380,7 @@ var _title = function ( config )
}

return title.indexOf( '*' ) !== -1 ?
title.replace( '*', $('title').text() || 'Exported data' ) :
title.replace( /\*/g, $('title').first().text() || 'Exported data' ) :
title;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ DataTable.ext.buttons.print = {
}

if ( title.indexOf( '*' ) !== -1 ) {
title= title.replace( '*', $('title').first().text() );
title= title.replace( /\*/g, $('title').first().text() );
}

win.document.close();
Expand Down

0 comments on commit 9b00989

Please sign in to comment.