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

Can you set Content-type="text/html" for file without extension? #40

Open
o7w opened this issue Oct 10, 2020 · 3 comments
Open

Can you set Content-type="text/html" for file without extension? #40

o7w opened this issue Oct 10, 2020 · 3 comments

Comments

@o7w
Copy link

o7w commented Oct 10, 2020

I want use URL like this "http://example.com/abc" instead of "http://example.com/abc.html",
Can you add an option to set Content-Type to text/html for files without extension?

@lmcarreiro
Copy link

I have a related problem... web assembly files (*.wasm extensions) need to use content-type application/wasm to avoid error on Google Chrome, but the current type being used is binary/octet-stream. Is there any way to replace the content-type of specific files?

@zmays
Copy link

zmays commented Mar 3, 2021

looks like you can do that with the optional args flag

@andre-lx
Copy link

andre-lx commented Mar 4, 2021

You can achieve this with the args flag as @zmays mentioned. As an example:

    - name: Deploy html files without extension and with content type
      uses: jakejarvis/s3-sync-action@master
      with:
        args: --acl public-read --follow-symlinks --delete --include '*' --exclude '*.*' --content-type text/html
      env:
        AWS_S3_BUCKET: ${{ env.BUCKET_NAME }}
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        AWS_REGION: 'eu-west-1'

This excludes all files with extension (something.some_extension), and upload all files without an extension (in this case, all files without the .html extension), and set the content-type to text/html for this files.

Since you can't upload all files with this content type (like js files), if you also want to upload all the other assets, you can upload all the files in another step and including all files with an extension:

    - name: Deploy all files
      uses: jakejarvis/s3-sync-action@master
      with:
        args: --acl public-read --follow-symlinks --include '*.*'
      env:
        AWS_S3_BUCKET: ${{ env.BUCKET_NAME }}
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        AWS_REGION: 'eu-west-1'

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

4 participants