Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: use maxsplit=1 in Redis URL parsing to handle URLs with multiple colons (#12239)

Andreas Schneider190fc7028891
diff --git a/src/paperless/settings/__init__.py b/src/paperless/settings/__init__.py
index b1f512fea..5c6f843fa 100644
--- a/src/paperless/settings/__init__.py
+++ b/src/paperless/settings/__init__.py
@@ -130,7 +130,7 @@ def _parse_redis_url(env_redis: str | None) -> tuple[str, str]:
if "unix" in env_redis.lower():
# channels_redis socket format, looks like:
# "unix:///path/to/redis.sock"
- _, path = env_redis.split(":")
+ _, path = env_redis.split(":", 1)
# Optionally setting a db number
if "?db=" in env_redis:
path, number = path.split("?db=")
@@ -141,7 +141,7 @@ def _parse_redis_url(env_redis: str | None) -> tuple[str, str]:
elif "+socket" in env_redis.lower():
# celery socket style, looks like:
# "redis+socket:///path/to/redis.sock"
- _, path = env_redis.split(":")
+ _, path = env_redis.split(":", 1)
if "?virtual_host=" in env_redis:
# Virtual host (aka db number)
path, number = path.split("?virtual_host=")