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 dfc619a181
commit 4111b8fabf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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);
}