billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=ae24098f738f61631ebfb82629c3bf5225cf5aab

commit ae24098f738f61631ebfb82629c3bf5225cf5aab
Author: Boris Faure <bill...@gmail.com>
Date:   Tue Sep 2 21:18:24 2014 +0200

    fix dnd with media with spaces. Closes T1586
    
    The path is url encoded without the prefix "file:".
---
 src/bin/media.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/bin/media.c b/src/bin/media.c
index f97a03d..ba2a412 100644
--- a/src/bin/media.c
+++ b/src/bin/media.c
@@ -1127,8 +1127,8 @@ Evas_Object *
 media_add(Evas_Object *parent, const char *src, const Config *config, int 
mode, int *type)
 {
    Evas *e;
-   Evas_Object *obj;
-   Media *sd;
+   Evas_Object *obj = NULL;
+   Media *sd = NULL;
    int t;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
@@ -1226,7 +1226,21 @@ media_add(Evas_Object *parent, const char *src, const 
Config *config, int mode,
      }
 #endif
 
-   if (!sd->url) sd->realf = eina_stringshare_add(sd->src);
+   if (!sd->url)
+     {
+        Efreet_Uri *uri;
+        const char *file_path = eina_stringshare_printf("file:%s", sd->src);
+        uri = efreet_uri_decode(file_path);
+        eina_stringshare_del(file_path);
+        if (!uri)
+          {
+             ERR("can not decode '%s'", sd->src);
+             goto err;
+          }
+        sd->realf = uri->path;
+        eina_stringshare_ref(sd->realf);
+        efreet_uri_free(uri);
+     }
 
    if ((mode & MEDIA_SIZE_MASK) == MEDIA_THUMB)
      {
@@ -1267,6 +1281,11 @@ media_add(Evas_Object *parent, const char *src, const 
Config *config, int mode,
    
    if (type) *type = t;
    return obj;
+
+err:
+   if (obj)
+     evas_object_del(obj);
+   return NULL;
 }
 
 void

-- 


Reply via email to