diff --git a/.changeset/shy-poems-retire.md b/.changeset/shy-poems-retire.md new file mode 100644 index 0000000000..f9dfaf2bfc --- /dev/null +++ b/.changeset/shy-poems-retire.md @@ -0,0 +1,5 @@ +--- +"@directus/api": patch +--- + +Fixed public branding assets permission issue diff --git a/api/src/services/assets.ts b/api/src/services/assets.ts index 8e50a20fb4..726c46acf3 100644 --- a/api/src/services/assets.ts +++ b/api/src/services/assets.ts @@ -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);