[PR #206] [MERGED] wrap mime.TypeByExtension with preset mimetypes #536

Closed
opened 2026-02-25 23:34:39 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-shiori/shiori/pull/206
Author: @cocoastorm
Created: 10/22/2019
Status: Merged
Merged: 10/23/2019
Merged by: @RadhiFadlillah

Base: masterHead: fix-js-mimetype


📝 Commits (1)

  • d1d48ad wrap mime.TypeByExtension with preset mimetypes

📊 Changes

1 file changed (+21 additions, -2 deletions)

View changed files

📝 internal/webserver/utils.go (+21 -2)

📄 Description

Fixes #182

Not quite sure if this is the best fix. But I looked at the files under view and they seem to be .css, .html, .js, .png. The corresponding mimetypes are preset in a map[string]string var.

This seems to only happen on Windows, as the mimetypes are extracted from the registry as per Golang docs

If there's no preset mimetype, it calls mime.TypeByExtension under the hood.

If you believe there's a less obtrusive fix, please let me know!

Cheers!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-shiori/shiori/pull/206 **Author:** [@cocoastorm](https://github.com/cocoastorm) **Created:** 10/22/2019 **Status:** ✅ Merged **Merged:** 10/23/2019 **Merged by:** [@RadhiFadlillah](https://github.com/RadhiFadlillah) **Base:** `master` ← **Head:** `fix-js-mimetype` --- ### 📝 Commits (1) - [`d1d48ad`](https://github.com/go-shiori/shiori/commit/d1d48ad788cde1fe7023160bb9024951dc6b80a1) wrap mime.TypeByExtension with preset mimetypes ### 📊 Changes **1 file changed** (+21 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `internal/webserver/utils.go` (+21 -2) </details> ### 📄 Description Fixes #182 Not quite sure if this is the best fix. But I looked at the files under `view` and they seem to be `.css`, `.html`, `.js`, `.png`. The corresponding mimetypes are preset in a `map[string]string` var. This seems to only happen on Windows, as the mimetypes are extracted from the registry as per [Golang docs](https://golang.org/pkg/mime/#TypeByExtension) If there's no preset mimetype, it calls `mime.TypeByExtension` under the hood. If you believe there's a less obtrusive fix, please let me know! Cheers! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-25 23:34:39 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#536
No description provided.