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

File getting corrupted with encrypt or sign true on Mac, Amazon Linux (maybe others too). #49

Closed
robincsamuel opened this issue Feb 19, 2022 · 4 comments

Comments

@robincsamuel
Copy link
Contributor

robincsamuel commented Feb 19, 2022

I tested the library on an ubuntu machine and everything worked well. But, then I tested the same on a mac and I got a corrupted file. The file size too was different. However, it works fine if I turn off the sign & encrypt options, or use content type binary. I've faced the same issue when I tested the same on an EC2 with Amazon Linux.

I've compared the binaries and t looks like the bytes are changing when decrypted.

And .txt or .csv works in either case. The issue is when a more complex file is transferred, like a png image or an xlsx file.

PS: I noticed #47 and it looks similar.

@abhishek-ram
Copy link
Owner

I have a mac and I have run it successfully there (same with EC2), please run django-pyas2 on both ends and let me know if the issue persists.

@robincsamuel
Copy link
Contributor Author

@abhishek-ram Yeah, I used django-pyas2 on both ends (I have set up two instances of ubuntu & Amazon Linux to test the same). The ubuntu version works fine, I tested that with a few other as2 gateways as well. But the Amazon Linux version and two of my MacBooks have the issue. It works if I exclusively set the content type to binary.

I can share access to these servers if you'd like to test it out.

@abhishek-ram
Copy link
Owner

well, for binary files you are expected to set the content type to binary as we cannot detect it automatically

@robincsamuel
Copy link
Contributor Author

Ah okay. I'm still wondering how it's working on an ubuntu server and not on others.

Also, it works when using any other client to send. For example, I earlier used the windows client, Mendelson as2, to send files to django-pyas2 (on ubuntu) and it worked fine. The content-type was always the default, application/edi-consent.

Please correct me if I'm wrong, the user who sends the file isn't explicitly selecting binary, it's set to application/edi-consent, so I'm a bit confused on what basis they'd decide if the content type should be set to binary or not? I mean, they are just uploading the file and sending it. It's base64 for .txt but binary for an image or an excel document.

PS: I'm new to AS2 protocol, and am still exploring. Please excuse :)

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

No branches or pull requests

2 participants