MCPcopy
hub / github.com/simstudioai/sim / hostMatches

Function hostMatches

packages/utils/src/media-embed.ts:37–40  ·  view source on GitHub ↗

* Whether `host` is one of `domains` or a subdomain of one (e.g. `m.youtube.com` * matches `youtube.com`). A null host (unparseable URL) never matches. This is the * security boundary for provider detection: a link is only treated as a given * platform when its parsed host actually belongs to tha

(host: string | null, ...domains: string[])

Source from the content-addressed store, hash-verified

35 * like `youtube.com.evil.com` or `evil.com/youtube.com/...` are rejected.
36 */
37function hostMatches(host: string | null, ...domains: string[]): boolean {
38 if (host === null) return false
39 return domains.some((domain) => host === domain || host.endsWith(`.${domain}`))
40}
41
42/**
43 * Rewrite a Dropbox share URL's host to `dl.dropboxusercontent.com` so the file

Callers 1

getEmbedInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected