escape filenames for terminology helpers.

This commit is contained in:
Carsten Haitzler 2013-04-19 00:19:21 +09:00
parent 5ea38eeeb1
commit 1f1fcf2dd2
2 changed files with 87 additions and 73 deletions

1
TODO
View File

@ -31,7 +31,6 @@ make it a first-class terminal:
[ ] number recognition with base (hex/dec/oct/binary etc.) conversion
[ ] dnd of file to term offer to paste path, with escapes or paste file
content (if text) with or without escaping
[ ] helpers when executed need to escape path/uri in command buffer
[ ] media - improve position slider to track position as u play
[ ] improve look of meida controls (youtube like better with mouse move show)
[ ] make media controls an api where controls are provided by the media

View File

@ -122,7 +122,7 @@ _activate_link(Evas_Object *obj)
{
Termio *sd = evas_object_smart_data_get(obj);
Config *config = termio_config_get(obj);
char buf[PATH_MAX], *s;
char buf[PATH_MAX], *s, *escaped;
const char *path = NULL, *cmd = NULL;
Eina_Bool url = EINA_FALSE, email = EINA_FALSE, handled = EINA_FALSE;
int type;
@ -165,13 +165,21 @@ _activate_link(Evas_Object *obj)
if (casestartswith(s, "mailto:"))
p += sizeof("mailto:") - 1;
snprintf(buf, sizeof(buf), "%s %s", cmd, p);
escaped = ecore_file_escape_name(p);
if (escaped)
{
snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
free(escaped);
}
}
else if (path)
{
// locally accessible file
cmd = "xdg-open";
escaped = ecore_file_escape_name(s);
if (escaped)
{
type = media_src_type_get(sd->link.string);
if (_should_inline(obj))
{
@ -210,7 +218,9 @@ _activate_link(Evas_Object *obj)
(config->helper.local.general[0]))
cmd = config->helper.local.general;
}
snprintf(buf, sizeof(buf), "%s %s", cmd, s);
snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
free(escaped);
}
}
}
else if (url)
@ -218,6 +228,9 @@ _activate_link(Evas_Object *obj)
// remote file needs ecore-con-url
cmd = "xdg-open";
escaped = ecore_file_escape_name(s);
if (escaped)
{
type = media_src_type_get(sd->link.string);
if (_should_inline(obj))
{
@ -258,7 +271,9 @@ _activate_link(Evas_Object *obj)
(config->helper.url.general[0]))
cmd = config->helper.url.general;
}
snprintf(buf, sizeof(buf), "%s %s", cmd, s);
snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
free(escaped);
}
}
}
else