[grilo] pls: Return an error when the entry media is of the wrong type



commit 121308824b96d42960a96a965e9bf6a0be096a94
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 17 14:30:06 2014 +0100

    pls: Return an error when the entry media is of the wrong type
    
    Ensure that the type of the returned media is GrlMediaBox when
    the detected type is GrlMediaBox.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724540
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 configure.ac       |    2 +-
 libs/pls/grl-pls.c |   10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2bcd594..4e35739 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ AC_DEFINE_UNQUOTED(GRLNET_VERSION, "$GRLNET_VERSION", [Grilo Net library version
 
 # Grilo Pls library
 
-GRLPLS_VERSION=0.2.0
+GRLPLS_VERSION=0.2.1
 AC_SUBST(GRLPLS_VERSION)
 AC_DEFINE_UNQUOTED(GRLPLS_VERSION, "$GRLPLS_VERSION", [Grilo Pls library version])
 
diff --git a/libs/pls/grl-pls.c b/libs/pls/grl-pls.c
index cfd61a6..c89585b 100644
--- a/libs/pls/grl-pls.c
+++ b/libs/pls/grl-pls.c
@@ -1294,6 +1294,16 @@ grl_pls_file_to_media (GrlMedia            *content,
         media = grl_media_new ();
       }
       set_media_id_from_file (media, file);
+    } else {
+      if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY &&
+          !GRL_IS_MEDIA_BOX (media)) {
+        char *uri;
+
+        uri = g_file_get_uri (file);
+        GRL_DEBUG ("URI '%s' is a directory but the passed media item is not GrlMediaBox type", uri);
+        g_free (uri);
+        return NULL;
+      }
     }
 
     if (!GRL_IS_MEDIA_BOX (media)) {


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