mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Fix http potential errors
Prevent from going further if {server} or {userid} is requested but not filled to avoid 401 errors
This commit is contained in:
parent
223818a807
commit
8d816414b8
1 changed files with 10 additions and 4 deletions
|
@ -53,11 +53,17 @@ class HTTP(object):
|
||||||
|
|
||||||
def _replace_user_info(self, string):
|
def _replace_user_info(self, string):
|
||||||
|
|
||||||
if self.config['auth.server']:
|
if '{server}' in string:
|
||||||
string = string.decode('utf-8').replace("{server}", self.config['auth.server'])
|
if self.config['auth.server']:
|
||||||
|
string = string.decode('utf-8').replace("{server}", self.config['auth.server'])
|
||||||
|
else:
|
||||||
|
raise Exception("Server address not set.")
|
||||||
|
|
||||||
if self.config['auth.user_id']:
|
if '{UserId}'in string:
|
||||||
string = string.decode('utf-8').replace("{UserId}", self.config['auth.user_id'])
|
if self.config['auth.user_id']:
|
||||||
|
string = string.decode('utf-8').replace("{UserId}", self.config['auth.user_id'])
|
||||||
|
else:
|
||||||
|
raise Exception("UserId is not set.")
|
||||||
|
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue