From d65667ce160de772390034ad68b73539d59b440c Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 24 Jan 2014 14:50:54 +0100 Subject: [PATCH] Don't force add basic auth to url --- couchpotato/core/helpers/variable.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 0a47f1de..69067e8d 100644 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -144,9 +144,14 @@ def cleanHost(host, protocol = True, ssl = False, username = None, password = No host = host.split('://', 1)[-1] if protocol and username and password: - login = '%s:%s@' % (username, password) - if not login in host: - host = host.replace('://', '://' + login, 1) + try: + auth = re.findall('^(?:.+?//)(.+?):(.+?)@(?:.+)$', host) + if auth: + log.error('Cleanhost error: auth already defined in url: %s, please remove BasicAuth from url.', host) + else: + host = host.replace('://', '://%s:%s@' % (username, password), 1) + except: + pass host = host.rstrip('/ ') if protocol: