mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-06-04 11:13:59 +08:00
fix: 修复 SUB_STORE_FRONTEND_PATH 使用绝对目录时前端资源 Content-Type 响应错误的问题
This commit is contained in:
parent
dfc619a181
commit
4111b8fabf
@ -76,9 +76,10 @@ export default function serve() {
|
|||||||
}
|
}
|
||||||
const express_ = eval(`require("express")`);
|
const express_ = eval(`require("express")`);
|
||||||
const mime_ = eval(`require("mime-types")`);
|
const mime_ = eval(`require("mime-types")`);
|
||||||
|
const path_ = eval(`require("path")`);
|
||||||
const staticFileMiddleware = express_.static(fe_path, {
|
const staticFileMiddleware = express_.static(fe_path, {
|
||||||
setHeaders: (res, path) => {
|
setHeaders: (res, path) => {
|
||||||
const type = mime_.contentType(path);
|
const type = mime_.contentType(path_.extname(path));
|
||||||
if (type) {
|
if (type) {
|
||||||
res.set('Content-Type', type);
|
res.set('Content-Type', type);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user