1// Copyright (C) 2020 Storj Labs, Inc.
2// See LICENSE for copying information.
3
4package consoleserver
5
6import "strings"
7
8// CommonContentType returns content-type for common extensions.
9func CommonContentType(ext string) (string, bool) {
10	ext = strings.ToLower(ext)
11	mime, ok := commonContentType[ext]
12	return mime, ok
13}
14
15var commonContentType = map[string]string{
16	".css":   "text/css; charset=utf-8",
17	".gif":   "image/gif",
18	".htm":   "text/html; charset=utf-8",
19	".html":  "text/html; charset=utf-8",
20	".jpeg":  "image/jpeg",
21	".jpg":   "image/jpeg",
22	".js":    "application/javascript",
23	".mjs":   "application/javascript",
24	".otf":   "font/otf",
25	".pdf":   "application/pdf",
26	".png":   "image/png",
27	".svg":   "image/svg+xml",
28	".ttf":   "font/ttf",
29	".wasm":  "application/wasm",
30	".webp":  "image/webp",
31	".xml":   "text/xml; charset=utf-8",
32	".sfnt":  "font/sfnt",
33	".woff":  "font/woff",
34	".woff2": "font/woff2",
35}
36