This seems to be a common registry misconfiguration on Windows.
Fixes #32350
Change-Id: I68c617c42a6e72948e2acdf335ff8e7df569432d
Reviewed-on: https://go-review.googlesource.com/c/go/+/406894
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
</dd>
</dl><!-- io -->
+<dl id="mime"><dt><a href="/pkg/mime/">mime</a></dt>
+ <dd>
+ <p><!-- CL 406894 -->
+ On Windows only, the mime package now ignores a registry entry
+ recording that the extension <code>.js</code> should have MIME
+ type <code>text/plain</code>. This is a common unintentional
+ misconfiguration on Windows systems. The effect is
+ that <code>.js</code> will have the default MIME
+ type <code>text/javascript; charset=utf-8</code>.
+ Applications that expect <code>text/plain</code> on Windows must
+ now explicitly call
+ <a href="/pkg/mime#AddExtensionType"><code>AddExtensionType</code></a>.
+ </p>
+ </dd>
+</dl>
+
<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
<dd>
<p><!-- CL 386016 -->
if err != nil {
continue
}
+
+ // There is a long-standing problem on Windows: the
+ // registry sometimes records that the ".js" extension
+ // should be "text/plain". See issue #32350. While
+ // normally local configuration should override
+ // defaults, this problem is common enough that we
+ // handle it here by ignoring that registry setting.
+ if name == ".js" && (v == "text/plain" || v == "text/plain; charset=utf-8") {
+ continue
+ }
+
setExtensionType(name, v)
}
}