~sotirisp/kindleto

14d29dbddc00b228075eebedfe91df5c1b34211a — Sotiris Papatheodorou 1 year, 10 months ago 4f0a6b1
Add MIME type for .txt

This mapping doesn't seem to exist in the Kindle 3 MIME type database.
1 files changed, 9 insertions(+), 2 deletions(-)

M file/proxy.go
M file/proxy.go => file/proxy.go +9 -2
@@ 96,8 96,15 @@ func (r *dirReader) Read(p []byte) (int, error) {
}

func init() {
	for _, ext := range []string{".gmi", ".gemini"} {
		err := mime.AddExtensionType(ext, "text/gemini")
	// The Kindle's MIME database doesn't seem to containg a mapping for
	// .txt.
	mappings := map[string]string{
		".gmi": "text/gemini",
		".gemini": "text/gemini",
		".txt": "text/plain",
	}
	for e, t := range mappings {
		err := mime.AddExtensionType(e, t)
		if err != nil {
			log.Println("file.Proxy:", err)
		}