From 23f2702757cd38643f40823d7a21f855beb35596 Mon Sep 17 00:00:00 2001 From: Brook Gagnon Date: Thu, 12 Sep 2024 21:56:22 +0000 Subject: [PATCH] don't require authenticated for getting public media --- controllers/media.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/media.php b/controllers/media.php index 27aaaf7..2375acd 100644 --- a/controllers/media.php +++ b/controllers/media.php @@ -617,10 +617,8 @@ public function delete() */ public function get() { - $this->user->require_authenticated(); $id = $this->data('id'); - $media = $this->models->media('get_by_id', ['id' => $id]); //T Media not found. @@ -628,6 +626,11 @@ public function get() return [false,'Media not found.']; } + // if not public, require autenticated + if ($media['status'] != 'public') { + $this->user->require_authenticated(); + } + if ($media['status'] == 'private' && $media['owner_id'] != $this->user->param('id')) { $this->user->require_permission('manage_media'); }