summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/DriveService.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-05-31 11:36:47 +0100
committerdakkar <dakkar@thenautilus.net>2024-05-31 11:36:47 +0100
commitad8d916775899c55f23ea19f6aa42b9342f95f3c (patch)
treee8e3953d2c90d13eb7020d52af6057a62e4b947b /packages/backend/src/core/DriveService.ts
parentmisskey-js update after our changes (diff)
downloadsharkey-ad8d916775899c55f23ea19f6aa42b9342f95f3c.tar.gz
sharkey-ad8d916775899c55f23ea19f6aa42b9342f95f3c.tar.bz2
sharkey-ad8d916775899c55f23ea19f6aa42b9342f95f3c.zip
minimal fixes, thanks tests
Diffstat (limited to 'packages/backend/src/core/DriveService.ts')
-rw-r--r--packages/backend/src/core/DriveService.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts
index 4203b03c74..dc84ea1999 100644
--- a/packages/backend/src/core/DriveService.ts
+++ b/packages/backend/src/core/DriveService.ts
@@ -632,8 +632,8 @@ export class DriveService {
@bindThis
public async updateFile(file: MiDriveFile, values: Partial<MiDriveFile>, updater: MiUser) {
- const profile = await this.userProfilesRepository.findOneBy({ userId: file.userId });
- const alwaysMarkNsfw = (await this.roleService.getUserPolicies(file.userId)).alwaysMarkNsfw || (profile !== null && profile!.alwaysMarkNsfw);
+ const profile = file.userId ? await this.userProfilesRepository.findOneBy({ userId: file.userId }) : null;
+ const alwaysMarkNsfw = file.userId ? (await this.roleService.getUserPolicies(file.userId)).alwaysMarkNsfw || (profile !== null && profile!.alwaysMarkNsfw) : false;
if (values.name != null && !this.driveFileEntityService.validateFileName(values.name)) {
throw new DriveService.InvalidFileNameError();