Bug: Cannot include `S3` image in a `GitHub` issue comment
nelsonic opened this issue Β· comments
We are able to upload images to S3
via REST API
π
URL: https://imgup.fly.dev/api/images
Docs: https://github.com/dwyl/imgup/blob/main/api.md#4-testing-the-api-from-hoppscotch
{
"compressed_url": "https://s3.eu-west-3.amazonaws.com/imgup-compressed/zb2rhoFgi1PXSfoeFi9PGT3R33fpq4iAsQJRuU2Yoy7yMzhj3.jpg",
"url": "https://s3.eu-west-3.amazonaws.com/imgup-original/zb2rhoFgi1PXSfoeFi9PGT3R33fpq4iAsQJRuU2Yoy7yMzhj3.jpg"
}
The problem is when we attempt to view one of these images directly in the browser e.g. by copy-pasting the URL
into a new browser tab: https://s3.eu-west-3.amazonaws.com/imgup-original/zb2rhoFgi1PXSfoeFi9PGT3R33fpq4iAsQJRuU2Yoy7yMzhj3.jpg
It automatically downloads the file instead of displaying it in the browser.
I suspect this is because the MIME Type is not correctly set on S3
...
This is why it does not display the image in a GitHub
issue comment or .md
file ...
![img](https://s3.eu-west-3.amazonaws.com/imgup-original/zb2rhoFgi1PXSfoeFi9PGT3R33fpq4iAsQJRuU2Yoy7yMzhj3.jpg)
... π€·ββοΈ
@LuchoTurtle do you have time to investigate this?
I've tried reading the docs: https://hexdocs.pm/ex_aws_s3/ExAws.S3.html#t:initiate_multipart_upload_opt/0
but can't seem to find where to put the Content-Type for the uploaded file ... π€·ββοΈ
I can look into this after I'm done with the Flutter task.
Adding content_type
to the S3.upload/4
function worked.
Full size: https://s3.eu-west-3.amazonaws.com/imgup-original/zb2rhhAwsGcVnvNMgmKJjAyFLiFM5KohnPkiEnftvTXQKV9fE.jpg
Sadly the compressed image still does not have the correct metadata:
@LuchoTurtle Thanks for looking in to this. π
Think it might be this line:
Needs to read the ContentType
of the original image and set it accordingly. π
@LuchoTurtle while
you're editing index.js
consider looking at #66 π