diff --git a/static/js/chat.js b/static/js/chat.js index 7727243..1aae6ca 100644 --- a/static/js/chat.js +++ b/static/js/chat.js @@ -1549,7 +1549,7 @@ $upload.addEventListener("click", async () => { const files = await selectFile( // the ultimate list - ".adoc,.bash,.bashrc,.bat,.c,.cc,.cfg,.cjs,.cmd,.conf,.cpp,.cs,.css,.csv,.cxx,.dockerfile,.dockerignore,.editorconfig,.env,.fish,.fs,.fsx,.gitattributes,.gitignore,.go,.gradle,.groovy,.h,.hh,.hpp,.htm,.html,.ini,.ipynb,.java,.jl,.js,.json,.jsonc,.jsx,.kt,.kts,.less,.log,.lua,.m,.makefile,.markdown,.md,.mjs,.mk,.mm,.php,.phtml,.pl,.pm,.profile,.properties,.ps1,.psql,.py,.pyw,.r,.rb,.rs,.rst,.sass,.scala,.scss,.sh,.sql,.svelte,.swift,.t,.toml,.ts,.tsv,.tsx,.txt,.vb,.vue,.xhtml,.xml,.xsd,.xsl,.xslt,.yaml,.yml,.zig,.zsh", + "text/*", true, file => { if (!file.name) { @@ -1558,10 +1558,10 @@ throw new Error("File name too long (max 512 characters)"); } - if (typeof file.content !== "string") { - throw new Error("File is not a text file"); - } else if (!file.content) { + if (!file.content) { throw new Error("File is empty"); + } else if (file.content.includes("\0")) { + throw new Error("File is not a text file"); } else if (file.content.length > 4 * 1024 * 1024) { throw new Error("File is too big (max 4MB)"); }