Gitea: Link directly to .css file in a repo?

Created on 25 Jul 2019  路  5Comments  路  Source: go-gitea/gitea

I'd like to do what the title says, from within a html file, but even when linking to the 'raw' file, it's mime type is transferred as text rather than css.

On GitHub you have to make a GitHub "Page" in order to link directly to a CSS file and have it transferred as the CSS mime type, but Gitea doesn't have a "pages" feature (which if fine by me), so I'm wondering if there's some way we can 'crowbar' this into happening for our own local Gitea server? It'd be kinda cool if there was some check-box or something on the file in the repo to set it's mime type ... or something.

I know I could just move my repo to Github and create a github page to do this, but I'd like to just be able to do so from my own repo server.

kinquestion reviewewontfix

Most helpful comment

If you have nginx or similar, you could regex-match the URL an change the content-type header there. Otherwise, maybe we want to support something like ?content-type=type but I'm not sure on the security implications of client-controlled content-type.

Sounds very dangerous. Since the file is hosted under the same domain as Gitea, this is an XSS vulnerability.

I don't think there is a safe way to do this without requiring admins to point two domains at Gitea.

All 5 comments

If you have nginx or similar, you could regex-match the URL an change the content-type header there. Otherwise, maybe we want to support something like ?content-type=type but I'm not sure on the security implications of client-controlled content-type.

If you have nginx or similar, you could regex-match the URL an change the content-type header there. Otherwise, maybe we want to support something like ?content-type=type but I'm not sure on the security implications of client-controlled content-type.

Sounds very dangerous. Since the file is hosted under the same domain as Gitea, this is an XSS vulnerability.

I don't think there is a safe way to do this without requiring admins to point two domains at Gitea.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

As @gary-kim said.

Was this page helpful?
0 / 5 - 0 ratings