Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Telegram/Growl notifiers message encodings #4657

Merged
merged 3 commits into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Fixed reference linking ([#4463](https://github.com/pymedusa/Medusa/pull/4463))
- Fixed the Show Selector not honoring user option to split shows & anime ([#4625](https://github.com/pymedusa/Medusa/pull/4625))
- Fixed unhandled request error on Add Existing Show ([#4639](https://github.com/pymedusa/Medusa/pull/4639))
- Fixed Telegram & Growl message encoding ([#4657](https://github.com/pymedusa/Medusa/pull/4657))
- _Simple message describing the fix, and a link to the pull request._

### [**Previous versions**](https://github.com/pymedusa/medusa.github.io/blob/master/news/CHANGES.md)
4 changes: 2 additions & 2 deletions medusa/notifiers/growl.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _send_growl(self, options, message=None):
if message:
notice.add_header('Notification-Text', message)

response = self._send(options['host'], options['port'], notice.encode(), options['debug'])
response = self._send(options['host'], options['port'], notice.encode('utf-8'), options['debug'])
return True if isinstance(response, gntp.core.GNTPOK) else False

@staticmethod
Expand Down Expand Up @@ -184,7 +184,7 @@ def _sendRegistration(self, host=None, password=None):
register.set_password(opts['password'])

try:
return self._send(opts['host'], opts['port'], register.encode(), opts['debug'])
return self._send(opts['host'], opts['port'], register.encode('utf-8'), opts['debug'])
except Exception as error:
log.warning(
u'GROWL: Unable to send growl to {host}:{port} - {msg!r}',
Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _send_telegram_msg(self, title, msg, user_id=None, api_key=None):

log.debug('Telegram in use with API KEY: {0}', api_key)

message = '%s : %s' % (title.encode(), msg.encode())
message = '{0} : {1}'.format(title, msg).encode('utf-8')
payload = urlencode({'chat_id': user_id, 'text': message})
telegram_api = 'https://api.telegram.org/bot%s/%s'

Expand Down