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

Specify or auto-detect asset content type, especially for images #409

Open
garyo opened this issue Feb 10, 2024 · 0 comments
Open

Specify or auto-detect asset content type, especially for images #409

garyo opened this issue Feb 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@garyo
Copy link

garyo commented Feb 10, 2024

It would be useful to me to be able to specify the content type (and ideally content-disposition) of assets uploaded as part of a release. Currently action-gh-release uses application/octet-stream for all assets, even images such as foo.png. Auto-detecting image types would be a good alternative.
For an example, see this workflow: https://github.com/garyo/sea-surface-temp-viz/blob/main/.github/workflows/make-images.yml

    - name: Create Release
      id: create_release
      uses: softprops/action-gh-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        name: ${{ steps.date.outputs.date }}
        tag_name: ${{ steps.date.outputs.date }}
        draft: false
        prerelease: false
        body: "Latest plots as of ${{ steps.date.outputs.date }}"
        files: |
           sst-map.png
           sst-anom-map.png
           sst-all.png
           sst-all-anom.png

This produces the following headers when retrieving one of the above png assets:

HTTP/2 200 
content-type: application/octet-stream
...
content-disposition: attachment; filename=sst-anom-map.png

and on the github releases page of that repo, clicking the image filename downloads it instead of opening the image because of the content-disposition. It would be good to be able to specify that it's an image to be shown directly.

As a proof of concept, I note that there is an unmaintained action, upload-release-asset, which allows users to specify the content-type using an asset_content_type specifier.

@softprops softprops added the enhancement New feature or request label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants