From 8e3615eca86e038bcee3960dad265e7f0f597377 Mon Sep 17 00:00:00 2001 From: Sakis bal <43223812+ThanasisMpalatsoukas@users.noreply.github.com> Date: Sun, 25 Jun 2023 22:53:07 +0300 Subject: [PATCH] fix: table columns with names of ' or "" or `` could not be dropped (#18506) * fix: table columns with names of ' or "" or `` could not be dropped Unsafe javascript string was passed to the currColumnName var. By using escapeJsString from /modules/functions/escape.ts the unsafe string becomes a safe string and the rest of the code runs as expected. fixes issue #18448 Signed-off-by: Thanasis Mpalatsoukas * fix: added an extra space below and added a signoff additionally Signed-off-by: Thanasis Mpalatsoukas --------- Signed-off-by: Thanasis Mpalatsoukas --- js/src/table/structure.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/src/table/structure.ts b/js/src/table/structure.ts index a556723c89..982234c0f0 100644 --- a/js/src/table/structure.ts +++ b/js/src/table/structure.ts @@ -7,7 +7,7 @@ import highlightSql from '../modules/sql-highlight.ts'; import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.ts'; import { Indexes } from '../modules/indexes.ts'; import getJsConfirmCommonParam from '../modules/functions/getJsConfirmCommonParam.ts'; -import { escapeHtml } from '../modules/functions/escape.ts'; +import { escapeHtml, escapeJsString } from '../modules/functions/escape.ts'; import refreshMainContent from '../modules/functions/refreshMainContent.ts'; /** @@ -191,7 +191,8 @@ AJAX.registerOnload('table/structure.js', function () { * @var currColumnName String containing name of the field referred to by {@link curr_row} */ var currColumnName = $currRow.children('th').children('label').text().trim(); - currColumnName = escapeHtml(currColumnName); + currColumnName = escapeJsString(escapeHtml(currColumnName)); + /** * @var $afterFieldItem Corresponding entry in the 'After' field. */