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

feat: Allow serving of images from an S3 bucket #335

Merged
merged 5 commits into from
Oct 5, 2022

Conversation

bagelbits
Copy link
Collaborator

@bagelbits bagelbits commented Oct 4, 2022

What does this do?

This serves an image based on the url.

How was it tested?

Locally

Is there a Github issue this is resolving?

N/A

Was any impacted documentation updated to reflect this change?

Yes. However, I'm not sure I want to document /api/images

Here's a fun image for your troubles

goblin

@bagelbits bagelbits marked this pull request as ready for review October 4, 2022 07:08
res.status(200);
res.end('Error Fetching File');
} else {
res.writeHead(200, { 'Content-Type': mime.lookup(params.Key) });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you be able to get the content type from data.Headers.ContentType? Instead of relying on the extension (which is what I assume mime.lookup does)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an interesting point! I'll see if I can do that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It ended up being data.ContentType but good catch!

@bagelbits bagelbits requested a review from Redmega October 4, 2022 21:46
@bagelbits bagelbits merged commit 9aed0ee into main Oct 5, 2022
@bagelbits bagelbits deleted the bagelbits.serve-images branch October 5, 2022 04:35
@github-actions
Copy link

github-actions bot commented Oct 5, 2022

🎉 This PR is included in version 2.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants