-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
[Bug] attachFile results in corrupted Microsoft Word file #177
Comments
A bit more info... When I read the file it is 18595 bytes, but when Cypress uploads, it has 31383 so for some reason it is almost doubling the length of the content. It has the same number of bytes for binary and base64 encodings, as well as with no provided encoding. |
And a bit more info... That explains why the uploaded version is almost twice the content length of the original. |
Hi, thanks for submitting the issue! Right now I am not able to take a look into the issue properly. Thanks for understanding. |
It does not exist in version 3 and that is what our company is using for
now. We are hoping to move from Robot Framework to Cypress for all our
functional testing, but we need to have firefox support before we can do
that. We will consider looking into it and submitting a PR if we can
resolve it, but I am not sure when (or if) that might be. Thank you!
…On Thu, Apr 9, 2020 at 7:45 AM abramenal ***@***.***> wrote:
Hi, thanks for submitting the issue!
Right now I am not able to take a look into the issue properly.
In the meantime, I can suggest to check if the issue exist in v3 (previous
major version):
https://github.com/abramenal/cypress-file-upload/tree/v3.5.3
Sorry about that. Not sure I can provide ETA on solving this issue in v4
since I am the only one contributor and maintainer. If you have ideas on
fixing that, please feel free to open Pull Request and we can review it
together.
Thanks for understanding.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#177 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACPHRS7VFYYIF2FVOYQ2MW3RLW7O3ANCNFSM4LSX2WVQ>
.
|
@dotwork did you use same encoding in v3? I think it should be |
Yes, I have tried it with |
Okay, let's keep this issue then. So you're saying you used 'base64' encoding in v3 and it worked correctly, right? |
We are using As far as testing, I should think that if you upload a docx file, and then download the file you uploaded, the download should have the same content length as the original version you uploaded. If the downloaded version is longer (different), then it's still modifying the file during upload somehow. I've attached the docx file we use in testing. |
I am also experiencing the same issue as documented, with a mp4. File size will have nearly doubled upon attachment and the file Cypress 4.9.0 Implementation looks like this: fileToUpload = fileToUpload + ".mp4"; Have tried calling attachFile directly without the fixture call as well. |
I am seeing same issue with mp4 file upload. After upload file was corrupt . jpg and .pdf upload works fine. |
After looking at #70 I could workaround this issue (where in my case a pdf file was corrupted) by using base64 encoding
|
This worked for me. I am using |
This worked for me when trying to test uploading an encrypted file thanks @jerdaane
|
Faced the issue while attaching a pptx file to input and adding the encoding fixed : Failing code : getInput().attachFile('file.pptx'); Working code : getInput().attachFile({
filePath: 'file.pptx',
encoding: 'base64'
}); Edit sometime after : After it worked for sometimes, its stopped working, can't make it work anymore. |
Current behavior:
I'm having a problem with
attachFile
. When uploading a valid docx file, it works on my test server if I do it manually, but when cypress does it, I get an error about it being corrupted from the server-side software that ingests it. I've tried various encodings, as well as no encoding.Here is the file in question:
valid_minimal.docx
This is the code I am using:
cy.get('input#ebook-upload-content').attachFile(pathToFile, {mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', encoding: 'base64'});
`
However, the error is being sent back from server-side software, Aspose Words, so unless you have access to that software, you will not receive the error I did. There is no issue ingesting and processing this file in our many other unit and functional tests, so it appears that the file upload process via Cypress specifically is changing the file somehow, in a way that corrupts it so that it cannot be processed by Aspose.
Versions
Cypress 4.2.0
cypress-file-upload 4.0.3
Chrome Version 80.0.3987.149 (Official Build) (64-bit)
Firefox 72.0.1 (64-bit)
Linux Mint
The text was updated successfully, but these errors were encountered: