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: locale match error (#115)

Joel96809108cac3
diff --git a/web/middleware.ts b/web/middleware.ts
index 5b17cbd6736..39ae80ee76e 100644
--- a/web/middleware.ts
+++ b/web/middleware.ts
@@ -23,7 +23,11 @@ export const getLocale = (request: NextRequest): Locale => {
}
// match locale
- const matchedLocale = match(languages, locales, i18n.defaultLocale) as Locale
+ let matchedLocale:Locale = i18n.defaultLocale
+ try {
+ // If languages is ['*'], Error would happen in match function.
+ matchedLocale = match(languages, locales, i18n.defaultLocale) as Locale
+ } catch(e) {}
return matchedLocale
}