MCPcopy
hub / github.com/FlowiseAI/Flowise / extractSlugFromUrl

Function extractSlugFromUrl

packages/server/src/utils/domainValidation.ts:93–100  ·  view source on GitHub ↗

* Extracts the slug from the URL if it matches any of the allowed slugs * @param url - The request URL * @returns string | null - The matched slug or null if no match

(url: string)

Source from the content-addressed store, hash-verified

91 * @returns string | null - The matched slug or null if no match
92 */
93function extractSlugFromUrl(url: string): string | null {
94 for (const publicUrl of ALLOWED_SLUGS) {
95 if (url.includes(publicUrl)) {
96 return publicUrl.replace(/\//g, '') // remove slashes
97 }
98 }
99 return null
100}
101
102/**
103 * Validates if a request is for public chatflows (embedded chatbots)

Callers 2

extractChatflowIdFunction · 0.85
isPublicChatflowRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected