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:
parent
acd8be51ab
commit
98d905b8e4
12
src/menu.c
12
src/menu.c
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user