-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Accessing to access uploaded SVG image on AWS S3 throws download box #341
Comments
Strange. Perhaps it was the SVG file that gave this issue. I will retry it and update it. Update: I just tried it and still have the same issue. Can you please try with this file. This is the file that was uploaded from Admin UI Asset Dashboard. https://dev-vendure.s3.amazonaws.com/ic-wheelchair.svg Browser: Google Chrome, Version 85.0.4150.0 (Official Build) canary (64-bit) |
OK, looked a bit deeper into this and there was indeed a bug with correct MIME type detection. Fixed and will be available in the next release. |
I;m having this same error with svg images, the aws-sdk works perfectly with jpg/png images but when i upload a svg image it opens the download window and if i open that download it says in my browser this error: error on line 1 at column 1: Encoding error. This is how i'm sending the image to s3: `let buf = new Buffer.from(image.replace(/^data:image/\w+;base64,/, ""),"base64");
|
@julymarval Are you using the AssetServerPlugin to handle uploads? I don't understand the workflow where you are sending assets to S3 yourself. Can you clarify? |
Hi @michaelbromley !!!. Sure, so I have a backoffice where i do all my configurations for my web page. One of them is to upload all my web images to a bucket in S3. I have my lambdas wrote in nodejs12 and i using the js aws-sdk 2.765.0. When i upload any image of type png or jpeg it success and the image is render in my web site with no problem. But when i upload a svg image it doesn't render in my website and when i try to open it directly from s3 i get this error: This page contains the following errors: error on line 1 at column 1: Document is empty Below is a rendering of the page up to the first error.. And this is how i'm uploading the image (it comes in base64 encoding fron the frontend) from my lambda to my s3 bucket: ` let buf = new Buffer.from(image.replace(/^data:image/\w+;base64,/, ""),"base64");
|
@julymarval I have a more fundamental question: are you using Vendure? This is an issue tracker for the e-commerce framework Vendure. If you are not using Vendure, then I suggest you try asking the question on a more general forum like StackOverflow. |
@julymarval and whomever stumbles upon this even though its not related to Vendure, |
@Luc-Olsthoorn I was led here on a similar issue and that simple change in the regex did the trick for me too. Thanks for sharing! |
Describe the bug
Uploading of SVG images on AWS S3 bucket work fine but while trying to access it throws browser download window.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
An image is shown on browser tab instead of brower download window.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: