From 58db4f012bfae26e0fe6dc9e64b338997348f1c9 Mon Sep 17 00:00:00 2001 From: sunnavy Date: Fri, 3 Jan 2025 15:26:37 -0500 Subject: [PATCH] Revert "Migrate deprecated "escape" to "encodeURIComponent"" This reverts commit a5d533cc41cfcae2d41aa7c9d0821b3a32786a21. Turned out that we can't simply replace escape with encodeURIComponent: they behave differently and the change caused wrongly-encoded titles/actions. --- share/static/js/util.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/static/js/util.js b/share/static/js/util.js index 238ab018b5..89bf4437e4 100644 --- a/share/static/js/util.js +++ b/share/static/js/util.js @@ -818,7 +818,7 @@ jQuery(function() { if ( evt.detail.value ) { for ( const action of evt.detail.value ) { // Need to decode action that is UTF-8 encoded - jQuery.jGrowl(decodeURIComponent(encodeURIComponent(action)), { themeState: 'none' }); + jQuery.jGrowl(decodeURIComponent(escape(action)), { themeState: 'none' }); } const history_container = document.querySelector('.history-container'); @@ -854,7 +854,7 @@ jQuery(function() { }); document.body.addEventListener('titleChanged', function(evt) { - document.title = decodeURIComponent(encodeURIComponent(evt.detail.value)); + document.title = decodeURIComponent(escape(evt.detail.value)); }); document.body.addEventListener('triggerChanged', function(evt) { @@ -865,7 +865,7 @@ jQuery(function() { document.body.addEventListener('widgetTitleChanged', function(evt) { const title = evt.detail.elt.closest('div.titlebox').querySelector('.titlebox-title a'); if ( title ) { - title.innerHTML = decodeURIComponent(encodeURIComponent(evt.detail.value)); + title.innerHTML = decodeURIComponent(escape(evt.detail.value)); } });