fix: 修复 SUB_STORE_FRONTEND_PATH 使用绝对目录时前端资源 Content-Type 响应错误的问题

This commit is contained in:
Aritro37
2025-03-19 15:52:37 +08:00
committed by GitHub
parent 63d5b3e6f7
commit ef7bfb11f7

View File

@@ -76,9 +76,10 @@ export default function serve() {
}
const express_ = eval(`require("express")`);
const mime_ = eval(`require("mime-types")`);
const path_ = eval(`require("path")`);
const staticFileMiddleware = express_.static(fe_path, {
setHeaders: (res, path) => {
const type = mime_.contentType(path);
const type = mime_.contentType(path_.extname(path));
if (type) {
res.set('Content-Type', type);
}