Skip to content

fix: use endwith() instead of endWith() - #3598

Merged
sampsyo merged 3 commits into
beetbox:masterfrom
jef:jef/fix-str
May 23, 2020
Merged

fix: use endwith() instead of endWith()#3598
sampsyo merged 3 commits into
beetbox:masterfrom
jef:jef/fix-str

Conversation

@jef

@jef jef commented May 22, 2020

Copy link
Copy Markdown
Member

Description

Fixes method call error created by this: #3449

Moved the helper static functions to the SubsonicUpdate class and made them private static.

Added tests for various of URL input and made sure that it can create a token and format URL correctly.

@jef
jef marked this pull request as draft May 22, 2020 20:30
@jef

jef commented May 22, 2020

Copy link
Copy Markdown
Member Author

Working on creating some tests so we don't run into this problem again.

@sampsyo

sampsyo commented May 22, 2020

Copy link
Copy Markdown
Member

So far, so good. 😃

@jef
jef marked this pull request as ready for review May 23, 2020 01:24
r = string.ascii_letters + string.digits
salt = "".join([random.choice(r) for _ in range(6)])
salted_password = password + salt
token = hashlib.md5(salted_password.encode('utf-8')).hexdigest()

@jef jef May 23, 2020

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also changed this, but hard to tell in GitHub diff...

Used to be hashlib.md5().update(salted_password.encode('utf-8')).hexdigest(). Seems like a better use of hashlib.

"""

url = config['subsonic']['url'].as_str()
if url and url.endswith('/'):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the main problem.

@sampsyo

sampsyo commented May 23, 2020

Copy link
Copy Markdown
Member

Nice; looks prefect to me! Thanks!!

@sampsyo
sampsyo merged commit 1b4686e into beetbox:master May 23, 2020
@jef
jef deleted the jef/fix-str branch May 24, 2020 14:46
@jef

jef commented May 24, 2020

Copy link
Copy Markdown
Member Author

Thanks as always!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants