Browse Source

文件读取bug

lrf 1 year ago
parent
commit
5a68819dc8
1 changed files with 1 additions and 1 deletions
  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)}`);
   }