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

Set ContentType for S3 uploads #329

Open
tomberek opened this issue Jul 31, 2019 · 4 comments
Open

Set ContentType for S3 uploads #329

tomberek opened this issue Jul 31, 2019 · 4 comments
Assignees

Comments

@tomberek
Copy link

tomberek commented Jul 31, 2019

Allow a method by which workers can set the contentType of the uploads. Not sure about the design. Perhaps a special .scar.yaml or other file name specified in the function specification that is read and used to populate ContentType in a YAML mapping?

@tomberek tomberek changed the title Set ContentType for S2 uploads Set ContentType for S3 uploads Aug 1, 2019
@alpegon
Copy link
Collaborator

alpegon commented Sep 5, 2019

Hi, thanks for using SCAR!, I have a some questions about your issue.
From the issue, I understand that you want to be able to define the content-type metadata of the files stored in S3.

What I don't understand is from where do you want to do it, I mean, are you uploading the files using SCAR? , like scar put -b bucket/folder -p my-file, or do you want to define the content-type of the files uploaded by the lambda function at the end of the execution?

For the first option we could add an extra parameter in the CLI with the content type, for the second option, maybe we can analyze the ending of the file and automatically set the content type for a predefined set of files.

Did I understand you correctly? What option would you need?

Regards

@tomberek
Copy link
Author

tomberek commented Sep 5, 2019

I was asking about the second option. I found where this is done, but currently it sets a blank content-type. I’ve tested hard coding it for my needs, but I am not sure what the right design is to expose it to users as a setting/configuration.

@alpegon
Copy link
Collaborator

alpegon commented Sep 6, 2019

I think we can include in the function payload a json file with some regex : type format like {".*\.png" : "image/png", ".*\.txt" : "text/plain"} and then check if the json file exist when the generated output files are going to be uploaded.
If the json file exist, for each file we would look if it matches some pattern and set the type accordingly.
If the json file doesn't exist or the file to upload doesn't match any pattern we leave the default type as we are doing now.

Do you think this approach could help you?

@alpegon alpegon self-assigned this Sep 6, 2019
@alpegon
Copy link
Collaborator

alpegon commented Sep 18, 2019

Ok, I can do that, no problem. In return I would like to know (if you don't mind) what is your use case. This project is a part of my PhD and I'm interested in applications created by the community. You can send me an email to alpegon3 at upv.es if you don't like to write it here.
Thank you very much.

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

No branches or pull requests

2 participants