Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

as_validate_has_hyperlink gives false positives #283

Closed
cassidyjames opened this issue Oct 1, 2020 · 1 comment
Closed

as_validate_has_hyperlink gives false positives #283

cassidyjames opened this issue Oct 1, 2020 · 1 comment

Comments

@cassidyjames
Copy link

as_validate_has_hyperlink causes validation to fail if I even mention the stand-alone string ftp:// in my release notes—without any actual hostname, which I did for my browser since I now handle protocols. :)

/**
* as_validate_has_hyperlink:
*
* Check if @text contains a hyperlink.
*/
static gboolean
as_validate_has_hyperlink (const gchar *text)
{
if (text == NULL)
return FALSE;
if (g_strstr_len (text, -1, "http://") != NULL)
return TRUE;
if (g_strstr_len (text, -1, "https://") != NULL)
return TRUE;
if (g_strstr_len (text, -1, "ftp://") != NULL)
return TRUE;
return FALSE;
}

See: cassidyjames/ephemeral#260 (comment)

@ximion
Copy link
Owner

ximion commented Oct 1, 2020

Fun! :-) Looks like we may need a regular expression here then (although I also could do some string expression fun, which may be faster). In any case, definitely a false-positive validation error, thanks for reporting it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants