Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
fix(core): use toObject to hide owner field
Browse files Browse the repository at this point in the history
  • Loading branch information
Juknum committed Nov 9, 2023
1 parent e9b56d0 commit 2d38980
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion src/modules/files/files.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class FilesController {
const file = await this.filesService.findOne(id);
await file.visibility?.init();

if (await this.filesService.canReadFile(file, req.user as User)) return file;
if (await this.filesService.canReadFile(file, req.user as User)) return file.toObject();
throw new UnauthorizedException(this.t.Errors.File.Unauthorized(file.visibility?.name));
}
}
1 change: 0 additions & 1 deletion tests/e2e/files.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ describe('Files (e2e)', () => {
id: file.id,
filename: 'test.png',
mimetype: 'image/png',
path: 'test.png',
size: 123,
visibility: file.visibility.id,
description: 'foo bar',
Expand Down

0 comments on commit 2d38980

Please sign in to comment.