Fix image permissions check and URL
This commit is contained in:
parent
1bb75fdd63
commit
7a420000fa
1 changed files with 4 additions and 2 deletions
|
@ -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 = [];
|
||||
|
|
Loading…
Reference in a new issue