Skip to content

Commit

Permalink
Revert "Migrate deprecated "escape" to "encodeURIComponent""
Browse files Browse the repository at this point in the history
This reverts commit a5d533c.

Turned out that we can't simply replace escape with encodeURIComponent: they
behave differently and the change caused wrongly-encoded titles/actions.
  • Loading branch information
sunnavy committed Jan 3, 2025
1 parent 67c8d51 commit 58db4f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions share/static/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand All @@ -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));
}
});

Expand Down

0 comments on commit 58db4f0

Please sign in to comment.