fix possible security issue
This commit is contained in:
parent
f12e6bae79
commit
20516e1046
2 changed files with 6 additions and 2 deletions
|
|
@ -120,7 +120,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
const [realm, name] = selected.split('/');
|
||||
// Get the base path by removing everything after /quests/compare/
|
||||
const basePath = window.location.pathname.split('/quests/compare/')[0];
|
||||
window.location.href = `${basePath}/quests/compare/${realm}/${name}`;
|
||||
const safeRealm = encodeURIComponent(realm);
|
||||
const safeName = encodeURIComponent(name);
|
||||
window.location.href = `${basePath}/quests/compare/${safeRealm}/${safeName}`;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -132,7 +132,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
const selected = compareSelect.value;
|
||||
if (selected) {
|
||||
const [realm, name] = selected.split('/');
|
||||
window.location.href = `${window.location.pathname}/compare/${realm}/${name}`;
|
||||
const sanitizedRealm = encodeURIComponent(realm);
|
||||
const sanitizedName = encodeURIComponent(name);
|
||||
window.location.href = `${window.location.pathname}/compare/${sanitizedRealm}/${sanitizedName}`;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue