Browse Source

Don't force add basic auth to url

pull/2775/head
Ruud 11 years ago
parent
commit
d65667ce16
  1. 11
      couchpotato/core/helpers/variable.py

11
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] host = host.split('://', 1)[-1]
if protocol and username and password: if protocol and username and password:
login = '%s:%s@' % (username, password) try:
if not login in host: auth = re.findall('^(?:.+?//)(.+?):(.+?)@(?:.+)$', host)
host = host.replace('://', '://' + login, 1) 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('/ ') host = host.rstrip('/ ')
if protocol: if protocol:

Loading…
Cancel
Save