Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: improve URL validation logic in validateRedirectUrl function (#27058)

GuanMufea2ffb3ba58
diff --git a/web/utils/urlValidation.ts b/web/utils/urlValidation.ts
index 372dd54cb4f..abc15a1365c 100644
--- a/web/utils/urlValidation.ts
+++ b/web/utils/urlValidation.ts
@@ -7,18 +7,17 @@
*/
export function validateRedirectUrl(url: string): void {
try {
- const parsedUrl = new URL(url);
- if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
- throw new Error("Authorization URL must be HTTP or HTTPS");
- }
- } catch (error) {
+ const parsedUrl = new URL(url)
+ if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:')
+ throw new Error('Authorization URL must be HTTP or HTTPS')
+ }
+ catch (error) {
if (
- error instanceof Error &&
- error.message === "Authorization URL must be HTTP or HTTPS"
- ) {
- throw error;
- }
+ error instanceof Error
+ && error.message === 'Authorization URL must be HTTP or HTTPS'
+ )
+ throw error
// If URL parsing fails, it's also invalid
- throw new Error(`Invalid URL: ${url}`);
+ throw new Error(`Invalid URL: ${url}`)
}
-}
\ No newline at end of file
+}