Bug(バグ) #2072
[api] /mediaitems/@me/@self/{albumId} で取得できるコレクションの albumId フィールドの値が間違っている
Start date:
2011-05-10
Due date:
% Done:
100%
3.6 で発生するか:
[QA]バグ通知済:
No
3.8 で発生するか:
Unknown (未調査)
Description
Overview (現象)¶
/mediaitems/@me/@self/{albumId} でアルバムに含まれるMediaItemのコレクションを取得すると、下記のように albumId フィールドがMediaItemのidの値になってしまう。
{
"entry": [
{
"albumId": "1",
"created": "2011-05-10 17:57:37",
"description": "0f7d8518b483d10f86a6d90edeb97979fd0af43a_png",
"fileSize": "0",
"id": "1",
"lastUpdated": "2011-05-10 17:57:37",
"thumbnailUrl": "http://sns.localhost/sqlite/cache/img/png/w180_h180/a_1_0f7d8518b483d10f86a6d90edeb97979fd0af43a_png.png",
"title": "0f7d8518b483d10f86a6d90edeb97979fd0af43a_png",
"type": "IMAGE",
"url": "http://sns.localhost/sqlite/cache/img/png/w_h/a_1_0f7d8518b483d10f86a6d90edeb97979fd0af43a_png.png"
},
{
"albumId": "2",
"created": "2011-05-10 17:57:38",
"description": "c51bc5e4eb6eec85258f088f9900c0f059d9c394_png",
"fileSize": "0",
"id": "2",
"lastUpdated": "2011-05-10 17:57:38",
"thumbnailUrl": "http://sns.localhost/sqlite/cache/img/png/w180_h180/a_1_c51bc5e4eb6eec85258f088f9900c0f059d9c394_png.png",
"title": "c51bc5e4eb6eec85258f088f9900c0f059d9c394_png",
"type": "IMAGE",
"url": "http://sns.localhost/sqlite/cache/img/png/w_h/a_1_c51bc5e4eb6eec85258f088f9900c0f059d9c394_png.png"
}
],
"itemsPerPage": 10,
"startIndex": 0,
"totalResults": 2
}
Causes (原因)¶
lib/util/opJsonDbOpensocialService.class.php にて、下記のように albumId にalbum_imageテーブルのidの値を入れている箇所があるため。
foreach ($objects as $object)
{
$result['albumId'] = $object->getId();
$result['created'] = $object->getCreatedAt();
$result['description'] = opOpenSocialToolKit::convertEmojiForApi($object->getDescription());
$result['fileSize'] = $object->getFilesize();
$result['id'] = $object->getId();
$result['lastUpdated'] = $object->getUpdatedAt();
$result['thumbnailUrl'] = '';
Way to fix (修正内容)¶
$result['albumId'] にalbum_imageテーブルの album_id の値を入れるように修正する。
Related issues
Associated revisions
fix the MediaItems API returns a wrong albumId in a collection (fixes #2072)
History
#1 Updated by Youichi Kimura over 13 years ago
- Status changed from New(新規) to Pending Review(レビュー待ち)
- % Done changed from 0 to 50
更新履歴 78db63b520e63508a6a6ff55d6ca9b4d3b70855f で適用されました。
#2 Updated by Youichi Kimura over 13 years ago
- Status changed from Pending Review(レビュー待ち) to Fixed(完了)
- Target version set to 1.3.2
- % Done changed from 50 to 100