Skip to content

Commit 01f1a9f

Browse files
authored
Fix domain checking for request (#40080)
1 parent 26b53ba commit 01f1a9f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

build/media_source/system/js/core.es6.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,12 @@ window.Joomla.Modal = window.Joomla.Modal || {
623623
const token = Joomla.getOptions('csrf.token', '');
624624

625625
// Use the CSRF only on the site's domain
626-
// eslint-disable-next-line no-restricted-globals
627-
if (token && (newOptions.url.startsWith('/') || newOptions.url.startsWith(location.origin))) {
626+
if (
627+
token && (
628+
(!newOptions.url.startsWith('http:') && !newOptions.url.startsWith('https:'))
629+
|| newOptions.url.startsWith(window.location.origin)
630+
)
631+
) {
628632
xhr.setRequestHeader('X-CSRF-Token', token);
629633
}
630634

0 commit comments

Comments
 (0)