Skip to content

mime: incorrect mime-type for .mjs files on windows (text/plain instead of application/javascript) #68591

Open
@RPGillespie6

Description

@RPGillespie6

Go version

1.21

What did you see happen?

This is identical to #32350 but .mjs instead of .js (I would have commented on the other thread, but it is locked to collaborators only).

.mjs is a fairly common javascript file extension for es modules (example: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#aside_%E2%80%94_.mjs_versus_.js)

I'm wondering if it would be acceptable to implement the same workaround found here, but for .mjs?

i.e. I could submit a PR to do:

		// 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" || name == ".mjs") && (v == "text/plain" || v == "text/plain; charset=utf-8") {
			continue
		}

What did you expect to see?

.mjs files should not be served with text/plain due to misconfigured registry

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windows

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions