Strip [linktext] before opening URL

[linktext] can contain arbitary data and also a possible URL, which
would get passed to the browser, making the actual URL invalid.
This commit is contained in:
Benedikt Heine 2017-11-23 14:30:02 +01:00
parent acd8be51ab
commit 98d905b8e4

View File

@ -95,10 +95,14 @@ char *extract_urls(const char *to_match)
*/
void open_browser(const char *in)
{
// remove prefix and test url
char *url = extract_urls(in);
if (!url)
return;
char *url = NULL;
// If any, remove leading [ linktext ] from URL
const char *end = strstr(in, "] ");
if (*in == '[' && end)
url = g_strdup(end + 2);
else
url = g_strdup(in);
int browser_pid1 = fork();