Skip to content

Commit d5b44c4

Browse files
committed
[fix] Only try to validate base_url if provided
1 parent ba827d7 commit d5b44c4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

mme_server/managers/servers.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ def add(self, server_id, server_label, server_key, direction, base_url=None):
6464
assert server_id and server_key and direction in ['in', 'out']
6565

6666
# Normalize url
67-
parsed_url = urlsplit(base_url)
68-
base_url = parsed_url.geturl()
69-
if base_url and not parsed_url.scheme == 'https' and not parsed_url.hostname == 'localhost':
70-
logger.error('base URL must start with "https://"')
71-
return
67+
if base_url:
68+
parsed_url = urlsplit(base_url)
69+
base_url = parsed_url.geturl()
70+
if not parsed_url.scheme == 'https' and not parsed_url.hostname == 'localhost':
71+
logger.error('base URL must start with "https://"')
72+
return
7273

7374
self.ensure_index_exists()
7475

0 commit comments

Comments
 (0)