fix dnd with media with spaces. Closes T1586

The path is url encoded without the prefix "file:".
This commit is contained in:
Boris Faure 2014-09-02 21:18:24 +02:00
parent 6bdf1aa644
commit ae24098f73
1 changed files with 22 additions and 3 deletions

View File

@ -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