Parcourir la source

文件读取bug

lrf il y a 1 an
Parent
commit
5a68819dc8
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  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)}`);
   }