Fix parsing of userscript headers containing tab chars

This commit is contained in:
Paweł Forysiuk 2011-02-05 12:16:46 +01:00 committed by Christian Dywan
parent 7939dc1bf1
commit dba9bb4780

View file

@ -938,8 +938,8 @@ js_metadata_from_file (const gchar* filename,
{
if (g_str_has_prefix (line, "// ==/UserScript=="))
found_meta = FALSE;
else if (g_str_has_prefix (line, "// @require ") ||
g_str_has_prefix (line, "// @resource "))
else if (g_str_has_prefix (line, "// @require")
|| g_str_has_prefix (line, "// @resource"))
{
/* We don't support these, so abort here */
g_free (line);
@ -964,6 +964,8 @@ js_metadata_from_file (const gchar* filename,
}
else if (name && g_str_has_prefix (line, "// @name"))
{
if (!strncmp (line, "// @namespace", 13))
continue;
rest_of_line = g_strdup (line + strlen ("// @name"));
rest_of_line = g_strstrip (rest_of_line);
*name = rest_of_line;