DavidSouther / ailly

Your AI Writing Ally
Other
9 stars 6 forks source link

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

Closed beqqrry-aws closed 4 months ago

beqqrry-aws commented 4 months ago

Go files are not listed in the "mime-types" package, so they get discarded at this line: https://github.com/DavidSouther/ailly/blob/531b7790b50484422dfd7c65c1f571f37a936a41/core/src/content/gitignore_fs.ts#L39

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.