mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Fix 500 in photos.get
when album does not exists
This commit is contained in:
parent
a2473c68fe
commit
49d62543ba
2 changed files with 7 additions and 10 deletions
|
@ -432,13 +432,11 @@ final class Photos extends VKAPIRequestHandler
|
||||||
if(empty($photo_ids)) {
|
if(empty($photo_ids)) {
|
||||||
$album = (new Albums)->getAlbumByOwnerAndId($owner_id, $album_id);
|
$album = (new Albums)->getAlbumByOwnerAndId($owner_id, $album_id);
|
||||||
|
|
||||||
if(!$album->getOwner()->getPrivacyPermission('photos.read', $this->getUser())) {
|
if(!$album || $album->isDeleted())
|
||||||
$this->fail(21, "This user chose to hide his albums.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$album || $album->isDeleted()) {
|
|
||||||
$this->fail(21, "Invalid album");
|
$this->fail(21, "Invalid album");
|
||||||
}
|
|
||||||
|
if(!$album->getOwner()->getPrivacyPermission('photos.read', $this->getUser()))
|
||||||
|
$this->fail(21, "This user chose to hide his albums.");
|
||||||
|
|
||||||
$photos = array_slice(iterator_to_array($album->getPhotos(1, $count + $offset)), $offset);
|
$photos = array_slice(iterator_to_array($album->getPhotos(1, $count + $offset)), $offset);
|
||||||
$res["count"] = sizeof($photos);
|
$res["count"] = sizeof($photos);
|
||||||
|
@ -456,8 +454,7 @@ final class Photos extends VKAPIRequestHandler
|
||||||
"items" => []
|
"items" => []
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach($photos as $photo)
|
foreach($photos as $photo) {
|
||||||
{
|
|
||||||
$id = explode("_", $photo);
|
$id = explode("_", $photo);
|
||||||
|
|
||||||
$phot = (new PhotosRepo)->getByOwnerAndVID((int)$id[0], (int)$id[1]);
|
$phot = (new PhotosRepo)->getByOwnerAndVID((int)$id[0], (int)$id[1]);
|
||||||
|
|
|
@ -130,7 +130,7 @@ class Albums
|
||||||
"owner" => $owner,
|
"owner" => $owner,
|
||||||
"id" => $id
|
"id" => $id
|
||||||
])->fetch();
|
])->fetch();
|
||||||
|
|
||||||
return new Album($album);
|
return $album ? new Album($album) : NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue