Skip to content

Add content-type to assets uploaded to s3 #1200

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

Merged
merged 1 commit into from
Oct 22, 2019

Conversation

stalgiag
Copy link
Contributor

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • is from a uniquely-named feature branch and has been rebased on top of the latest master. (If I was asked to make more changes, I have made sure to rebase onto master then too)
  • is descriptively named and links to an issue number, i.e. Fixes #123

resolves #496
addresses #1196

This adds the relevant Content-Type metadata to files uploaded to AWS. This fixes a bug introduced with p5 v0.10.2 which checks the header's content-type to determine whether an asset is a GIF.

I have tested this locally with a personal S3 bucket.

Potential issues - I think this only handles assets uploaded through the drag+drop interface. I assume that this is the only way that a user will upload a media asset but I could be wrong.

@welcome
Copy link

welcome bot commented Oct 21, 2019

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already.

@catarak
Copy link
Member

catarak commented Oct 22, 2019

yay thank you!

eventually, it will be possible to upload assets via the api (#542), but that can be handled separately from this PR.

@catarak
Copy link
Member

catarak commented Oct 22, 2019

one major issue is that all of the assets currently uploaded to S3 don't have a content type, so we'll need to write a script to update them. i'm looking at https://stackoverflow.com/questions/41015200/how-to-change-content-type-of-amazon-s3-objects

EDIT: however, since old sketches will still be using older versions of p5.js, maybe it's fine to just leave it.

@catarak
Copy link
Member

catarak commented Oct 22, 2019

anyway, this is working great for me and i'm going to merge it.

@catarak catarak merged commit d5dfe39 into processing:master Oct 22, 2019
@stalgiag
Copy link
Contributor Author

Oh yeah! I didn't think about that. Perhaps this will be an edge-case? Updating the version on existing projects seems rare, but I may be missing something. If writing a script to update the existing assets proves difficult, then we could add something on the p5 side to catch this and at least output a helpful warning.

@stalgiag stalgiag deleted the contentTypeMetaAssetUpload branch October 22, 2019 21:46
@catarak
Copy link
Member

catarak commented Oct 22, 2019

i imagine that folks will rarely update the p5.js version in existing sketches, so yeah, i think it's more of an edge case. it would be cool if p5.js could throw out a useful warning if possible!

@stalgiag
Copy link
Contributor Author

I agree! Opened a PR on the p5 library side :-)

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

Successfully merging this pull request may close these issues.

Blank Content-Type set for uploaded assets in S3
2 participants