codePreviews: ignore non-plaintext

This commit is contained in:
Cynthia Foxwell 2023-06-14 21:42:40 -06:00
parent a8f59ea6ac
commit 0a6417c0f7

View file

@ -23,6 +23,7 @@ function unindent(str) {
async function processFile(link) { async function processFile(link) {
const res = await fetch(link); const res = await fetch(link);
if (!res.ok) return ""; if (!res.ok) return "";
if (!res.headers.get("Content-Type").startsWith("text/plain")) return "";
const file = await res.text(); const file = await res.text();
const lines = file.replace(/\r/g, "").split("\n"); const lines = file.replace(/\r/g, "").split("\n");