fix: correctly parse legacy OBSIDIAN_HOST format 'host:port' to avoid double port in URL
This commit is contained in:
@@ -84,10 +84,19 @@ class Obsidian():
|
|||||||
host = parsed.hostname or '127.0.0.1'
|
host = parsed.hostname or '127.0.0.1'
|
||||||
port = parsed.port or (27124 if protocol == 'https' else 27123)
|
port = parsed.port or (27124 if protocol == 'https' else 27123)
|
||||||
else:
|
else:
|
||||||
# Legacy hostname/IP only format
|
# Support legacy formats
|
||||||
protocol = 'https'
|
# 1) hostname/IP only
|
||||||
host = host_config
|
# 2) hostname:port (no protocol)
|
||||||
port = 27124
|
if ':' in host_config:
|
||||||
|
# Treat as host:port and default protocol to https
|
||||||
|
parsed = urlparse(f'https://{host_config}')
|
||||||
|
protocol = 'https'
|
||||||
|
host = parsed.hostname or '127.0.0.1'
|
||||||
|
port = parsed.port or 27124
|
||||||
|
else:
|
||||||
|
protocol = 'https'
|
||||||
|
host = host_config
|
||||||
|
port = 27124
|
||||||
|
|
||||||
return protocol, host, port
|
return protocol, host, port
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user