mirror of
https://github.com/golang/go.git
synced 2025-05-25 09:21:21 +00:00
mime: ignore .js => text/plain in Windows registry
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>
This commit is contained in:
parent
1247354a08
commit
52f68efa45
@ -216,6 +216,22 @@ Do not send CLs removing the interior tags from such phrases.
|
||||
</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 -->
|
||||
|
@ -30,6 +30,17 @@ func initMimeWindows() {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user