Skip to content

Commit

Permalink
fix(api/internal): url.protocol can be undefined
Browse files Browse the repository at this point in the history
during xhr open "url" is sometimes a string (if url is invalid) protect
against this in the protocol check
  • Loading branch information
chrisfarms authored and jwerle committed Jul 9, 2024
1 parent 99d1fcb commit 7cb3e6b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/internal/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@ if (typeof globalThis.XMLHttpRequest === 'function') {

if (
globalThis.__args?.config?.webview_fetch_allow_runtime_headers === true ||
/(socket|ipc|node|npm):/.test(url.protocol) ||
protocols.handlers.has(url.protocol.slice(0, -1)) ||
(url.protocol && /(socket|ipc|node|npm):/.test(url.protocol)) ||
(url.protocol && protocols.handlers.has(url.protocol.slice(0, -1))) ||
url.hostname === globalThis.__args.config.meta_bundle_identifier
) {
for (const key in additionalHeaders) {
Expand Down

0 comments on commit 7cb3e6b

Please sign in to comment.