プロジェクト

全般

プロフィール

Backport(バックポート) #2148

[api] /albums/@me/@self で取得したアルバムのサムネイルが未設定の場合 thumbnailUrl フィールドに間違った値が入る

Youichi Kimuraほぼ13年前に追加. ほぼ13年前に更新.

ステータス:
Fixed(完了)
優先度:
Normal(通常)
担当者:
-
対象バージョン:
開始日:
2011-06-03
期日:
進捗率:

100%


説明

Overview (現象)

/albums/@me/@self でアルバムのコレクションを取得すると、サムネイルが未設定のアルバムに http://sns.example.com/cache/img/jpg/w180_h180/.jpg のようなURLが入ってしまう。

{
  "entry": [
    {
      "id": "1",
      "title": "test",
      "description": "aaaaa",
      "mediaItemCount": 2,
      "ownerId": "3",
      "thumbnailUrl": "http:\/\/sns.localhost\/sqlite\/cache\/img\/jpg\/w180_h180\/.jpg",
      "mediaType": "IMAGE" 
    }
  ],
  "startIndex":0,
  "totalResults":1,
  "itemsPerPage":10
}

Causes (原因)

lib/util/opJsonDbOpensocialService.class.php で以下のようにサムネイルの有無をチェックしている箇所があるが、サムネイルが未設定の場合 (album.file_id = null) は $object->getFile() メソッドの実行時に File オブジェクトのインスタンスが新規に生成されてしまうため条件式が偽にならずURLの生成が行われてしまう。

$result['thumbnailUrl'] = '';
if ($object->getFile())
{
  sfContext::getInstance()->getConfiguration()->loadHelpers(array('Asset', 'sfImage'));
  $result['thumbnailUrl'] = sf_image_path($object->getFile(), array('size' => '180x180'), true);
}

Way to fix (修正内容)

getFile() メソッドではなく getFileId() メソッドを使用してサムネイルの有無をチェックする。


関連するチケット

関連している opOpenSocialPlugin - Bug(バグ) #2145: [api] /albums/@me/@self で取得したアルバムのサムネイルが未設定の場合 thumbnailUrl フィールドに間違った値が入る Fixed(完了) 2011-06-03

関係しているリビジョン

リビジョン 9ae56f5e (差分)
Youichi Kimuraほぼ13年前に追加

fix weird thumbnailUrl of a album on RESTful API (fixes #2148, BP from #2145)

履歴

#1 Youichi Kimuraほぼ13年前に更新

  • ステータスPending Fixing(修正待ち) から Pending Review(レビュー待ち) に変更
  • 進捗率0 から 50 に変更

更新履歴 9ae56f5eded86ca107b7fde591f98034eb04220c で適用されました。

#2 Shogo Kawaharaほぼ13年前に更新

  • ステータスPending Review(レビュー待ち) から Fixed(完了) に変更
  • 進捗率50 から 100 に変更

他の形式にエクスポート: Atom PDF