summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2022-08-03 21:55:53 -0400
committermorpheus65535 <[email protected]>2022-08-03 21:55:53 -0400
commit4382a05da1ad0864b74acdf911c591f3c80d6918 (patch)
treed95f93cc5026913d597550e0535f92aa291783e0
parentba1687a478ea2c7a647d6308979eab2c114efdc0 (diff)
downloadbazarr-4382a05da1ad0864b74acdf911c591f3c80d6918.tar.gz
bazarr-4382a05da1ad0864b74acdf911c591f3c80d6918.zip
Fixed double slashes stored in config.ini by sanitizing the config values. #1903v1.1.1-beta.10
-rw-r--r--bazarr/app/config.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/bazarr/app/config.py b/bazarr/app/config.py
index 5a22dad62..85abf7762 100644
--- a/bazarr/app/config.py
+++ b/bazarr/app/config.py
@@ -20,6 +20,12 @@ class SimpleConfigParser(simpleconfigparser):
return None
+def base_url_slash_cleaner(uri):
+ while "//" in uri:
+ uri = uri.replace("//", "/")
+ return uri
+
+
defaults = {
'general': {
'ip': '0.0.0.0',
@@ -286,6 +292,11 @@ if int(settings.sonarr.episodes_sync) < 15:
if int(settings.radarr.movies_sync) < 15:
settings.radarr.movies_sync = "60"
+# Make sure to get of double slashes in base_url
+settings.general.base_url = base_url_slash_cleaner(uri=settings.general.base_url)
+settings.sonarr.base_url = base_url_slash_cleaner(uri=settings.sonarr.base_url)
+settings.radarr.base_url = base_url_slash_cleaner(uri=settings.radarr.base_url)
+
if os.path.exists(os.path.join(args.config_dir, 'config', 'config.ini')):
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
settings.write(handle)
@@ -375,6 +386,9 @@ def save_settings(settings_items):
elif value == 'false':
value = 'False'
+ if key in ['settings-general-base_url', 'settings-sonarr-base_url', 'settings-radarr-base_url']:
+ value = base_url_slash_cleaner(value)
+
if key == 'settings-auth-password':
if value != settings.auth.password and value is not None:
value = hashlib.md5(value.encode('utf-8')).hexdigest()