From 9b009890010d927ce791e5644a601321d9d7e98c Mon Sep 17 00:00:00 2001 From: kristinmerbach <78749008+kristinmerbach@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:42:35 -0700 Subject: [PATCH] only use the first title element for all datatables buttons (#4449) * only use the first title element * fix security issue --- .../assets/javascripts/dataTables/buttons/buttons.html5.js | 4 ++-- .../assets/javascripts/dataTables/buttons/buttons.print.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/project_gems/effective_datatables-2.6.14/app/assets/javascripts/dataTables/buttons/buttons.html5.js b/project_gems/effective_datatables-2.6.14/app/assets/javascripts/dataTables/buttons/buttons.html5.js index d6715049200..3032bbb8738 100755 --- a/project_gems/effective_datatables-2.6.14/app/assets/javascripts/dataTables/buttons/buttons.html5.js +++ b/project_gems/effective_datatables-2.6.14/app/assets/javascripts/dataTables/buttons/buttons.html5.js @@ -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 @@ -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; }; diff --git a/project_gems/effective_datatables-2.6.14/app/assets/javascripts/dataTables/buttons/buttons.print.js b/project_gems/effective_datatables-2.6.14/app/assets/javascripts/dataTables/buttons/buttons.print.js index e9a5a358380..f43d2e4abdd 100755 --- a/project_gems/effective_datatables-2.6.14/app/assets/javascripts/dataTables/buttons/buttons.print.js +++ b/project_gems/effective_datatables-2.6.14/app/assets/javascripts/dataTables/buttons/buttons.print.js @@ -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();