Skip to content

Commit

Permalink
Fix code scanning alert no. 21: DOM text reinterpreted as HTML
Browse files Browse the repository at this point in the history
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Dr. Hans-Peter Störr <[email protected]>
  • Loading branch information
stoerr and github-advanced-security[bot] authored Nov 13, 2024
1 parent 114e3a0 commit 9b85cb5
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,22 @@
// Event listeners for URL input fields
leftField.addEventListener('change', function () {
leftLoaded = false;
leftIframe.src = this.value;
try {
const url = new URL(this.value);
leftIframe.src = url.href;
} catch (e) {
console.error('Invalid URL:', this.value);
}
});

rightField.addEventListener('change', function () {
rightLoaded = false;
rightIframe.src = this.value;
try {
const url = new URL(this.value);
rightIframe.src = url.href;
} catch (e) {
console.error('Invalid URL:', this.value);
}
});

// Function to parse URL parameters
Expand Down

0 comments on commit 9b85cb5

Please sign in to comment.