Skip to content

[API] Provide correct MIME type when getting a raw text file #8152

Closed
@danielappelt

Description

@danielappelt
  • Gitea version (or commit ref): 1.10.0+dev-274-g3fd0eec90
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

When fetching a raw text file via the API the content type header does not reflect the file's MIME type.
https://try.gitea.io/api/v1/repos/go-gitea/gitea/raw/public/js/draw.js

Content-Type: text/plain; charset=utf-8

Expected result would be:

Content-Type: application/javascript

When fetching an image file via the API, the content type seems to be set correctly though:
https://try.gitea.io/api/v1/repos/go-gitea/gitea/raw/public/img/404.png

Content-Type: image/png

This is related to issue #7620.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/securitySomething leaks user information or is otherwise vulnerable. Should be fixed!type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions