From: Jens Georg Date: Thu, 15 Mar 2012 07:56:59 +0000 (+0100) Subject: core: Return 404 on missing thumbnail X-Git-Tag: RYGEL_0_13_4~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e3b36dcc18effbd2e67b2ddaa8b6a43b1ec165f;p=profile%2Fivi%2Frygel.git core: Return 404 on missing thumbnail https://bugzilla.gnome.org/show_bug.cgi?id=672048 --- diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala index a7ca2ef..c98d56c 100644 --- a/src/rygel/rygel-http-get.vala +++ b/src/rygel/rygel-http-get.vala @@ -90,31 +90,36 @@ internal class Rygel.HTTPGet : HTTPRequest { if (this.uri.thumbnail_index >= 0) { if (this.item is MusicItem) { var music = this.item as MusicItem; - this.thumbnail = music.album_art; + + return; } else if (this.item is VisualItem) { var visual = this.item as VisualItem; - if (visual.thumbnails.size >= this.uri.thumbnail_index) { + if (this.uri.thumbnail_index < visual.thumbnails.size) { this.thumbnail = visual.thumbnails.get (this.uri.thumbnail_index); + + return; } - } else { - throw new HTTPRequestError.NOT_FOUND - ("No Thumbnail available for item '%s", - this.item.id); } - } else if (this.uri.subtitle_index >= 0) { - if (!(this.item is VideoItem)) { - throw new HTTPRequestError.NOT_FOUND - ("No subtitles available for item '%s", + + throw new HTTPRequestError.NOT_FOUND + ("No Thumbnail available for item '%s", this.item.id); - } + } + if (this.uri.subtitle_index >= 0 && this.item is VideoItem) { var video = this.item as VideoItem; - if (this.uri.subtitle_index <= video.subtitles.size) { + if (this.uri.subtitle_index < video.subtitles.size) { this.subtitle = video.subtitles.get (this.uri.subtitle_index); + + return; } + + throw new HTTPRequestError.NOT_FOUND + ("No subtitles available for item '%s", + this.item.id); } }