Files
klz-cables.com/.pnpm-store/v10/files/fa/8146431025a62278abe6cba5225a9f70ca6a5cdce84ac0456950d56088c2785083d82e2f3cfa7a02c6d3b542fbf7dd886577ff7f95c0fa55c9e08542c0148a
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

42 lines
1.3 KiB
Plaintext

import { parseStringToURLObject, isURLObjectRelative } from './url.js';
/**
* Checks whether given url points to Sentry server
*
* @param url url to verify
*/
function isSentryRequestUrl(url, client) {
const dsn = client?.getDsn();
const tunnel = client?.getOptions().tunnel;
return checkDsn(url, dsn) || checkTunnel(url, tunnel);
}
function checkTunnel(url, tunnel) {
if (!tunnel) {
return false;
}
return removeTrailingSlash(url) === removeTrailingSlash(tunnel);
}
function checkDsn(url, dsn) {
// Requests to Sentry's ingest endpoint must have a `sentry_key` in the query string
// This is equivalent to the public_key which is required in the DSN
// see https://develop.sentry.dev/sdk/overview/#parsing-the-dsn
// Therefore, a request to the same host and with a `sentry_key` in the query string
// can be considered a request to the ingest endpoint.
const urlParts = parseStringToURLObject(url);
if (!urlParts || isURLObjectRelative(urlParts)) {
return false;
}
return dsn ? urlParts.host.includes(dsn.host) && /(^|&|\?)sentry_key=/.test(urlParts.search) : false;
}
function removeTrailingSlash(str) {
return str[str.length - 1] === '/' ? str.slice(0, -1) : str;
}
export { isSentryRequestUrl };
//# sourceMappingURL=isSentryRequestUrl.js.map