From 1e3b36dcc18effbd2e67b2ddaa8b6a43b1ec165f Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Thu, 15 Mar 2012 08:56:59 +0100 Subject: [PATCH] core: Return 404 on missing thumbnail https://bugzilla.gnome.org/show_bug.cgi?id=672048 --- src/rygel/rygel-http-get.vala | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) 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); } } -- 2.7.4