Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Update URL Validation Regex to Support IP Addresses and Port Numbers (#1233)

Juanan Pereira819650a25474
diff --git a/embedchain/loaders/json.py b/embedchain/loaders/json.py
index 13f4f7e62..5acbc0389 100644
--- a/embedchain/loaders/json.py
+++ b/embedchain/loaders/json.py
@@ -36,8 +36,7 @@ class JSONReader:
return ["\n".join(useful_lines)]
-VALID_URL_PATTERN = "^https:\/\/[0-9A-Za-z]+(\.[0-9A-Za-z]+)*\/[0-9A-Za-z_\/]*\.json$"
-
+VALID_URL_PATTERN = "^https?://(?:www\.)?(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[a-zA-Z0-9.-]+)(?::\d+)?/(?:[^/\s]+/)*[^/\s]+\.json$"
class JSONLoader(BaseLoader):
@staticmethod