1
1
Fork 0

Update Friendica Photo API endpoint fix to pass null for scale when not applied

This commit is contained in:
Hank Grabowski 2022-12-12 12:37:01 -05:00
parent 46607598f3
commit 4e5794c99d
2 changed files with 3 additions and 3 deletions

View file

@ -57,14 +57,14 @@ class Photo extends BaseFactory
* @param string $type
* @return Array
*/
public function createFromId(string $photo_id, int $scale, int $uid, string $type = 'json', bool $with_posts = true): array
public function createFromId(string $photo_id, int $scale = null, int $uid, string $type = 'json', bool $with_posts = true): array
{
$fields = ['resource-id', 'created', 'edited', 'title', 'desc', 'album', 'filename','type',
'height', 'width', 'datasize', 'profile', 'allow_cid', 'deny_cid', 'allow_gid', 'deny_gid',
'backend-class', 'backend-ref', 'id', 'scale'];
$condition = ['uid' => $uid, 'resource-id' => $photo_id];
if ($scale >= 0) {
if (intval($scale)) {
$fields = array_merge(['data'], $fields);
$condition['scale'] = $scale;

View file

@ -54,7 +54,7 @@ class Photo extends BaseApi
throw new HTTPException\BadRequestException('No photo id.');
}
$scale = (!empty($request['scale']) ? intval($request['scale']) : -1);
$scale = (!empty($request['scale']) ? intval($request['scale']) : null);
$photo_id = $request['photo_id'];
// prepare json/xml output with data from database for the requested photo