techaddicted opened a new issue #195: db.attachment.get function corrupts attachment URL: https://github.com/apache/couchdb-nano/issues/195 <!--- Provide a general summary of the issue in the Title above --> ## Expected Behavior <!--- If you're describing a bug, tell us what should happen --> <!--- If you're suggesting a change/improvement, tell us how it should work --> Insert attachment into couchdb with db.attachment.insert as seen in official documentation [Insert](https://www.npmjs.com/package/nano#dbattachmentinsertdocname-attname-att-contenttype-params-callback) and retrieving the attachment from couchdb with db.attachment.get as seen in official documentation [get](https://www.npmjs.com/package/nano#dbattachmentgetdocname-attname-params-callback) should provide you with the attachment in its original form. ## Current Behavior <!--- If describing a bug, tell us what happens instead of the expected behavior --> <!--- If suggesting a change/improvement, explain the difference from current behavior --> Retrieving the attachment via attachment.get causes the attachment to be corrupted. Examples for corrupted attachments are pictures in jpg and png format and other file types such as docx. The only attachment not corrupted is txt files. Corrupted files are roughly 2x size and feature the wrong file signature. It must be noted that this seems not to be a couchdb server issue, since the attachment, in the case of an image, is displayed correctly in the management web gui. In addition, the python couchdb client does not corrupt the attachment, so it must be an error in couchdb-nano. ## Steps to Reproduce (for bugs) <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug. Include code to reproduce, if relevant --> 1. Setup couchdb 2.3.1 with default setting 2. Insert attachment into couchdb as seen in official couchdb-nano documentation or via web gui upload 3. Get attachment via couchdb-nano attachment.get function as seen in official couchdb-nano documentation 4. Try to open image results in error like "fatal error reading jpg image file: not a jpg file" ## Context <!--- How has this issue affected you? What are you trying to accomplish? --> <!--- Providing context helps us come up with a solution that is most useful in the real world --> - Unable to retrieve attachment in a non corrupt form ## Your Environment <!--- Include as many relevant details about the environment you experienced the bug in --> * Version used: couchdb: 2.3.1, couchdb-nano: 8.1.0, node 8.17.0 * Operating System and version (desktop or mobile): Ubuntu 18.04
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
