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

Character vs. byte strings fix #300

Merged
merged 6 commits into from
Feb 16, 2024
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
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

argo-ams-library
certifi<2020.4.5.2 # Used by AMS (via requests), 2020.4.5.2 dropped support for Python 2
pyopenssl<=21.0.0 # 22.0.0 dropped support for Python 2
cryptography==3.3.0 # Crypto dropped support for Python 2 after 3.3. They're now on 41.X...
pyopenssl >=19.1.0, <=21.0.0 # 22.0.0 dropped support for Python 2
cryptography==3.3.2 # Crypto dropped support for Python 2 after 3.3
stomp.py<5.0.0
python-daemon<=2.3.0 # 2.3.1 dropped support for Python 2
python-ldap<3.4.0 # python-ldap-3.4.0 dropped support for Python 2
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def main():
download_url='https://github.com/apel/ssm/releases',
license='Apache License, Version 2.0',
install_requires=[
'cryptography==3.3.0',
'cryptography==3.3.2',
'stomp.py<5.0.0',
'python-ldap<3.4.0',
'setuptools',
'pyopenssl<=21.0.0',
'pyopenssl >=19.1.0, <=21.0.0',
],
extras_require={
'AMS': ['argo-ams-library', 'certifi<2020.4.5.2', ],
Expand Down
6 changes: 5 additions & 1 deletion ssm/ssm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@

def _save_msg_to_queue(self, body, empaid):
"""Extract message contents and add to the accept or reject queue."""
if isinstance(body, bytes):
body = body.decode('ascii')

extracted_msg, signer, err_msg = self._handle_msg(body)
try:
# If the message is empty or the error message is not empty
Expand All @@ -332,7 +335,6 @@
body = extracted_msg

log.warning("Message rejected: %s", err_msg)

name = self._rejectq.add({'body': body,
'signer': signer,
'empaid': empaid,
Expand Down Expand Up @@ -479,6 +481,8 @@
continue

text = self._outq.get(msgid)
if isinstance(text, bytes):
text = text.decode('ascii')

Check warning on line 485 in ssm/ssm2.py

View check run for this annotation

Codecov / codecov/patch

ssm/ssm2.py#L485

Added line #L485 was not covered by tests

if self._protocol == Ssm2.STOMP_MESSAGING:
# Then we are sending to a STOMP message broker.
Expand Down
Loading