[rygel/rygel-0-12] core: Use correct error in CreateObject



commit a41c92d8a9418fd961aa481cd243ce37f49b4572
Author: Jens Georg <mail jensge org>
Date:   Mon Jan 9 19:05:38 2012 +0100

    core: Use correct error in CreateObject
    
    If CreateObject is called with an id that describes an item instead of
    a container ContentDirectory:2 spec says that the error should be 701
    (No such object) instead of 713 (Restricted parent)

 src/rygel/rygel-item-creator.vala |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index 3cbd36f..f89b46e 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -283,11 +283,10 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
                                         (this.container_id, this.cancellable);
         }
 
-        if (media_object == null) {
+        if (media_object == null || !(media_object is MediaContainer)) {
             throw new ContentDirectoryError.NO_SUCH_OBJECT
                                         (_("No such object"));
-        } else if (!(media_object is MediaContainer) ||
-                   !(OCMFlags.UPLOAD in media_object.ocm_flags)) {
+        } else if (!(OCMFlags.UPLOAD in media_object.ocm_flags)) {
             throw new ContentDirectoryError.RESTRICTED_PARENT
                                         (_("Object creation in %s not allowed"),
                                         media_object.id);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]