1
0
Fork 0
mirror of synced 2024-09-29 17:01:37 +13:00

Fix image permissions check and URL

This commit is contained in:
Jake Barnby 2024-02-19 20:48:52 +13:00
parent 1bb75fdd63
commit 7a420000fa
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -2856,7 +2856,9 @@ App::post('/v1/messaging/messages/push')
throw new Exception(Exception::STORAGE_FILE_NOT_FOUND);
}
if (!\in_array(Permission::read(Role::any()), $image->getRead())) {
$bucket = $dbForProject->getDocument('buckets', $image->getAttribute('bucketId'));
if (!\in_array(Permission::read(Role::any()), \array_merge($image->getRead(), $bucket->getRead()))) {
throw new Exception(Exception::STORAGE_FILE_NOT_PUBLIC);
}
@ -2872,7 +2874,7 @@ App::post('/v1/messaging/messages/push')
throw new Exception(Exception::STORAGE_FILE_NOT_PUBLIC);
}
$image = "{$protocol}://{$host}/v1/storage/files/{$image->getId()}/view";
$image = "{$protocol}://{$host}/v1/storage/buckets/{$bucket->getId()}/files/{$image->getId()}/view?project={$project->getId()}";
}
$pushData = [];