Skip to content

Commit

Permalink
fix: don't decode queries containing %
Browse files Browse the repository at this point in the history
  • Loading branch information
Crissium committed Oct 25, 2023
1 parent dff4990 commit 609377a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
14 changes: 10 additions & 4 deletions client/src/DesktopApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function DesktopApp() {
.then((data) => {
setHistory(data);
});

fetch(`${API_PREFIX}/management/history_size`)
.then(loadDataFromJsonResponse)
.then((data) => {
Expand Down Expand Up @@ -132,9 +132,15 @@ export default function DesktopApp() {
return;
}

newQuery = decodeURIComponent(newQuery);
setQuery(newQuery);
newQuery = encodeURIComponent(newQuery);
try {
newQuery = decodeURIComponent(newQuery);
setQuery(newQuery);
newQuery = encodeURIComponent(newQuery);
}
catch (error) {
setQuery(newQuery);
newQuery = encodeURIComponent(newQuery);
}

// Clean up previous scripts to avoid potential conflicts and DOM tree clutter
const scripts = document.querySelectorAll('script');
Expand Down
12 changes: 9 additions & 3 deletions client/src/MobileApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,15 @@ export default function MobileApp() {
return;
}

newQuery = decodeURIComponent(newQuery);
setQuery(newQuery);
newQuery = encodeURIComponent(newQuery);
try {
newQuery = decodeURIComponent(newQuery);
setQuery(newQuery);
newQuery = encodeURIComponent(newQuery);
}
catch (error) {
setQuery(newQuery);
newQuery = encodeURIComponent(newQuery);
}

// Clean up previous scripts to avoid potential conflicts and DOM tree clutter
const scripts = document.querySelectorAll('script');
Expand Down

0 comments on commit 609377a

Please sign in to comment.