Fix public assets (#21360)

This commit is contained in:
Brainslug
2024-02-07 16:09:18 +01:00
committed by GitHub
parent 2f8cdfe6b5
commit ccbb34acd9
2 changed files with 7 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"@directus/api": patch
---
Fixed public branding assets permission issue

View File

@@ -38,7 +38,7 @@ export class AssetsService {
constructor(options: AbstractServiceOptions) {
this.knex = options.knex || getDatabase();
this.accountability = options.accountability || null;
this.filesService = new FilesService(options);
this.filesService = new FilesService({ ...options, accountability: null });
this.authorizationService = new AuthorizationService(options);
}
@@ -69,9 +69,7 @@ export class AssetsService {
await this.authorizationService.checkAccess('read', 'directus_files', id);
}
const file = (await this.filesService.readOne(id, { limit: 1 })) as File | undefined;
if (!file) throw new ForbiddenError();
const file = (await this.filesService.readOne(id, { limit: 1 })) as File;
const exists = await storage.location(file.storage).exists(file.filename_disk);