Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@
document.querySelectorAll('.list-filter-dropdown select').forEach(select => {
select.addEventListener('change', (event) => {
const value = event.target.value;
if (value) {
window.location = value;
if (!value) {
return;
}

try {
const url = new URL(value, window.location.href);
if (
(url.protocol === 'http:' || url.protocol === 'https:') &&
url.origin === window.location.origin
) {
window.location = url.href;
}
} catch (error) {
// Ignore invalid URLs.
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined') {
// fix for django 1.7 TODO remove
iframeSrc = updateURLParameter(iframeSrc, '_popup', '1');

// build the iframe html
const iframeHTML = '<iframe id="related-modal-iframe" name="' + iframeName + '" src="' + iframeSrc + '"></iframe>';
const modalHTML = '<div class="related-modal-iframe-container">' + iframeHTML + '</div>';
const modalEl = $(modalHTML);
const iframeEl = modalEl.find('#related-modal-iframe');
// build the iframe using DOM API to avoid XSS via string concatenation
const iframeEl = $('<iframe>').attr({
id: 'related-modal-iframe',
name: iframeName,
src: iframeSrc,
});
const modalEl = $('<div>').addClass('related-modal-iframe-container').append(iframeEl);

if (e.data.lookup === true) {
// set current window as iframe opener because
Expand Down
Loading