Link directly to .css file in a repo? #3675

Closed
opened 2025-11-02 05:21:23 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @STaRDoGG on GitHub (Jul 25, 2019).

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.

Originally created by @STaRDoGG on GitHub (Jul 25, 2019). 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.
GiteaMirror added the type/questionreviewed/wontfix labels 2025-11-02 05:21:23 -06:00
Author
Owner

@silverwind commented on GitHub (Jul 26, 2019):

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.

@silverwind commented on GitHub (Jul 26, 2019): 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.
Author
Owner

@gary-kim commented on GitHub (Jul 29, 2019):

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.

@gary-kim commented on GitHub (Jul 29, 2019): > 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.
Author
Owner

@stale[bot] commented on GitHub (Sep 27, 2019):

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.

@stale[bot] commented on GitHub (Sep 27, 2019): 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.
Author
Owner

@stale[bot] commented on GitHub (Nov 29, 2019):

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.

@stale[bot] commented on GitHub (Nov 29, 2019): 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.
Author
Owner

@lunny commented on GitHub (Nov 29, 2019):

As @gary-kim said.

@lunny commented on GitHub (Nov 29, 2019): As @gary-kim said.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3675