Source file
src/mime/type_windows.go
1
2
3
4
5 package mime
6
7 import (
8 "internal/syscall/windows/registry"
9 )
10
11 func init() {
12 osInitMime = initMimeWindows
13 }
14
15 func initMimeWindows() {
16 names, err := registry.CLASSES_ROOT.ReadSubKeyNames()
17 if err != nil {
18 return
19 }
20 for _, name := range names {
21 if len(name) < 2 || name[0] != '.' {
22 continue
23 }
24 k, err := registry.OpenKey(registry.CLASSES_ROOT, name, registry.READ)
25 if err != nil {
26 continue
27 }
28 v, _, err := k.GetStringValue("Content Type")
29 k.Close()
30 if err != nil {
31 continue
32 }
33
34
35
36
37
38
39
40 if name == ".js" && (v == "text/plain" || v == "text/plain; charset=utf-8") {
41 continue
42 }
43
44 setExtensionType(name, v)
45 }
46 }
47
48 func initMimeForTests() map[string]string {
49 return map[string]string{
50 ".PnG": "image/png",
51 }
52 }
53
View as plain text