Skip to content

Commit

Permalink
perf(store): get path from query
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed May 7, 2023
1 parent b631974 commit a0132c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions apps/core/src/modules/store/store.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ export class StoreController {
@ApiOperation({ summary: '上传文件' })
// @Auth()
@HTTPDecorators.FileUpload({ description: 'upload file' })
async upload(@Req() req: FastifyRequest, @Body('path') _path?: string) {
async upload(@Req() req: FastifyRequest) {
const data = await req.file();

const _path = (req.query as any).path as string;
if (!data) {
throw new BadRequestRpcExcption('仅能上传文件!');
}
Expand Down Expand Up @@ -110,7 +111,7 @@ export class StoreController {
return transportReqToMicroservice(
this.store,
StoreEvents.StoreFileDeleteByMaster,
{ path },
path,
);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/store-service/src/store-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class StoreServiceService {
const _path = join(STORE_DIR, path || '');
const name = data.filename;
if (this.assetHelper.exists(join(_path, name))) {
throw new InternalServerErrorRpcExcption('文件夹已存在');
throw new InternalServerErrorRpcExcption('文件已存在');
}
return await this.assetHelper
.writeFile(data.file, _path, name)
Expand Down

0 comments on commit a0132c9

Please sign in to comment.