fix: remove x-file-name for ZHONGWEN 错误

This commit is contained in:
熊潇 2025-05-25 00:03:39 +08:00
parent 4d39b22bdd
commit a9f0170775
2 changed files with 5 additions and 3 deletions

View File

@ -9,6 +9,10 @@
"key": "page-proxy", "key": "page-proxy",
"entry": "dist/app.js", "entry": "dist/app.js",
"type": "pm2-system-app", "type": "pm2-system-app",
"runtime": [
"client",
"server"
],
"files": [ "files": [
"dist" "dist"
] ]

View File

@ -75,14 +75,12 @@ const getAiProxy = async (req: IncomingMessage, res: ServerResponse, opts: Proxy
const contentLength = stat.size; const contentLength = stat.size;
const etag = stat.etag; const etag = stat.etag;
const lastModified = stat.lastModified.toISOString(); const lastModified = stat.lastModified.toISOString();
const fileName = objectName.split('/').pop();
const objectStream = await minioClient.getObject(bucketName, objectName); const objectStream = await minioClient.getObject(bucketName, objectName);
const headers = { const headers = {
'Content-Length': contentLength, 'Content-Length': contentLength,
etag, etag,
'last-modified': lastModified, 'last-modified': lastModified,
'x-file-name': fileName,
...filterMetaData, ...filterMetaData,
}; };
@ -194,7 +192,7 @@ export const postProxy = async (req: IncomingMessage, res: ServerResponse, opts:
}; };
export const getObjectName = async (req: IncomingMessage, opts?: { checkOwner?: boolean }) => { export const getObjectName = async (req: IncomingMessage, opts?: { checkOwner?: boolean }) => {
const _u = new URL(req.url, 'http://localhost'); const _u = new URL(req.url, 'http://localhost');
const pathname = _u.pathname; const pathname = decodeURIComponent(_u.pathname);
const params = _u.searchParams; const params = _u.searchParams;
const { user, app } = getUserFromRequest(req); const { user, app } = getUserFromRequest(req);
const checkOwner = opts?.checkOwner ?? true; const checkOwner = opts?.checkOwner ?? true;