From ccbb34acd9423bae09831991e378fbcc3ea46abc Mon Sep 17 00:00:00 2001 From: Brainslug Date: Wed, 7 Feb 2024 16:09:18 +0100 Subject: [PATCH] Fix public assets (#21360) --- .changeset/shy-poems-retire.md | 5 +++++ api/src/services/assets.ts | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .changeset/shy-poems-retire.md 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);