diff --git a/src/mime/testdata/test.types.globs2 b/src/mime/testdata/test.types.globs2 index 2e893262ea1..cb5b7899b0d 100644 --- a/src/mime/testdata/test.types.globs2 +++ b/src/mime/testdata/test.types.globs2 @@ -6,3 +6,4 @@ # mime package test for globs2 50:document/test:*.t3 50:example/test:*.t4 +30:example/do-not-use:*.t4 diff --git a/src/mime/type_unix.go b/src/mime/type_unix.go index 59c99e2c86c..f954bc8a1fb 100644 --- a/src/mime/type_unix.go +++ b/src/mime/type_unix.go @@ -49,7 +49,15 @@ func loadMimeGlobsFile(filename string) error { continue } - setExtensionType(fields[2][1:], fields[1]) + extension := fields[2][1:] + if _, ok := mimeTypes.Load(extension); ok { + // We've already seen this extension. + // The file is in weight order, so we keep + // the first entry that we see. + continue + } + + setExtensionType(extension, fields[1]) } if err := scanner.Err(); err != nil { panic(err)