Fix directory EISDIR on root path, remove favicon

This commit is contained in:
CallMeVerity
2026-06-03 01:43:24 +01:00
parent 3369f22f69
commit ba9752d33c
2 changed files with 3 additions and 6 deletions
+3 -2
View File
@@ -3,7 +3,7 @@ import { cors } from "@elysiajs/cors";
import { videoRoutes } from "./routes/videos";
import { initDb } from "./services/db";
import { join } from "path";
import { existsSync } from "fs";
import { existsSync, statSync } from "fs";
initDb();
@@ -25,7 +25,8 @@ const app = new Elysia()
if (pathname.startsWith("/api")) return status(404, "Not found");
const filePath = join(STATIC_DIR, pathname);
if (existsSync(filePath)) return Bun.file(filePath);
if (existsSync(filePath) && statSync(filePath).isFile())
return Bun.file(filePath);
const indexPath = join(STATIC_DIR, "index.html");
if (existsSync(indexPath)) return Bun.file(indexPath);