Project

General

Profile

Backport(バックポート) #2075

[api] /mediaitems/@me/@self/{albumId} で取得できるコレクションの albumId フィールドの値が間違っている

Added by Youichi Kimura over 8 years ago. Updated about 8 years ago.

Status:
Fixed(完了)
Priority:
Normal(通常)
Target version:
Start date:
2011-05-10
Due date:
% Done:

100%


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

Related to opOpenSocialPlugin - Bug(バグ) #2072: [api] /mediaitems/@me/@self/{albumId} で取得できるコレクションの albumId フィールドの値が間違っている Fixed(完了) 2011-05-10

Associated revisions

Revision 4df6f86c (diff)
Added by Youichi Kimura about 8 years ago

fix the MediaItems API returns a wrong albumId in a collection (fixes #2075, BP from #2072)

History

#1 Updated by Youichi Kimura over 8 years ago

  • Target version set to 1.2.4

#2 Updated by Youichi Kimura about 8 years ago

  • Status changed from Pending Fixing(修正待ち) to Pending Review(レビュー待ち)

更新履歴 4df6f86c385228bf1fa23c00119be26ff00cee5e で適用されました。

#3 Updated by Youichi Kimura about 8 years ago

  • Status changed from Pending Review(レビュー待ち) to Fixed(完了)
  • % Done changed from 50 to 100

Also available in: Atom PDF