Skip to content

Commit

Permalink
"DOM text reinterpreted as HTML" security issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
DogukanUrker committed Jan 17, 2024
1 parent 94df3ba commit ebf69c2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
9 changes: 6 additions & 3 deletions static/standardUI/js/navbar.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
function search() {
var input = document.getElementById("searchInput").value;
if (input === "" || input.replace(/\s/g, "") === "") {
const input = document.querySelector("#searchInput").value;
if (input === "" || input.trim() === "") {
} else {
window.location.href = `/search/${input.replace(/\s/g, "+")}`;
window.location.href = `/search/${encodeURIComponent(
escape(input.trim())
)}`;
}
}

function hamburger() {
document.getElementById("hamburgerDropdown").classList.toggle("show");
}
Expand Down
9 changes: 5 additions & 4 deletions static/standardUI/js/searchBar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
function searchBar() {
var input = document.querySelector("#searchBarInput").value;
console.log(input);
if (input === "" || input.replace(/\s/g, "") === "") {
const input = document.querySelector("#searchBarInput").value;
if (input === "" || input.trim() === "") {
} else {
window.location.href = `/search/${input.replace(/\s/g, "+")}`;
window.location.href = `/search/${encodeURIComponent(
escape(input.trim())
)}`;
}
}
9 changes: 6 additions & 3 deletions static/tailwindUI/js/navbar.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
function search() {
var input = document.getElementById("searchInput").value;
if (input === "" || input.replace(/\s/g, "") === "") {
const input = document.querySelector("#searchInput").value;
if (input === "" || input.trim() === "") {
} else {
window.location.href = `/search/${input.replace(/\s/g, "+")}`;
window.location.href = `/search/${encodeURIComponent(
escape(input.trim())
)}`;
}
}

function hamburger() {
document.getElementById("hamburgerDropdown").classList.toggle("show");
}
Expand Down

0 comments on commit ebf69c2

Please sign in to comment.