Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: gitignore_fs.ts->isTextExtension incorrectly discards ".go" files. #74

Closed
beqqrry-aws opened this issue May 2, 2024 · 0 comments · Fixed by #75
Closed

core: gitignore_fs.ts->isTextExtension incorrectly discards ".go" files. #74

beqqrry-aws opened this issue May 2, 2024 · 0 comments · Fixed by #75
Labels
bug Something isn't working

Comments

@beqqrry-aws
Copy link
Contributor

beqqrry-aws commented May 2, 2024

Go files are not listed in the "mime-types" package, so they get discarded at this line:

const contType = contentType(name) || "";

How to reproduce:
This example Typescript file attempts to use the "mime-types" package to determine the type of different common programming files:

import { contentType } from "mime-types";

const goType = contentType("test.go");
const jsType = contentType("test.js");
const cppType = contentType("test.cpp");
const phpType = contentType("test.php");

console.log({ goType, jsType, cppType, phpType });

The output of running this program is:
{ goType: false, jsType: 'application/javascript; charset=utf-8', cppType: 'text/x-c; charset=utf-8', phpType: 'application/x-httpd-php' }

goType unexpectedly returns as false.

Possible solution: Add an allowlist to allow for explicit acceptance of certain file types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants