Pārlūkot izejas kodu

文件读取bug

lrf 1 gadu atpakaļ
vecāks
revīzija
5a68819dc8
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      src/controller/file.controller.ts

+ 1 - 1
src/controller/file.controller.ts

@@ -57,7 +57,7 @@ export class FileController {
   @Get('/files/*')
   async readFile() {
     const shortRealPath = this.fileService.getFileShortRealPath();
-    const realPath = join(process.cwd(), this.uploadDir, shortRealPath);
+    const realPath = join(this.uploadDir, shortRealPath);
     this.ctx.body = createReadStream(realPath);
     this.ctx.response.set('content-type', `/files/${getType(realPath)}`);
   }