Skip to content

improve docs and remove check we already do in check_domain ... also …#65

Open
grosser wants to merge 1 commit intovmg:masterfrom
zendesk:grosser/docs
Open

improve docs and remove check we already do in check_domain ... also …#65
grosser wants to merge 1 commit intovmg:masterfrom
zendesk:grosser/docs

Conversation

@grosser
Copy link
Copy Markdown
Contributor

@grosser grosser commented Oct 11, 2016

/ is not supported since we check if the string starts with ':' earlier

@vmg @kivikakk

@grosser
Copy link
Copy Markdown
Contributor Author

grosser commented Oct 13, 2016

I can haz review ?

Comment thread ext/rinku/autolink.c

if (link_len > len &&
strncasecmp((char *)link, valid_uris[i], len) == 0 &&
rinku_isalnum(link[len]))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hesitant to remove this in case autolink_issafe gets another consumer. As the overarching "is this safe to auto-link?" method, I'd rather leave this check in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just because there is 1 alphanum character does not mean it's safe to link ... implementing partial checks in multiple places seems like a bad security model ... ideally this method would be "is_safe_protocol" ...

Comment thread ext/rinku/autolink.c
link->end = utf8proc_find_space(data, link->end, size);

// move to before the protocol
while (link->start && rinku_isalpha(data[link->start - 1]))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these kinds of comments are helpful. (see the gist of this article)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is pretty cryptic and took us a while to understand ... so I think having some top-level understanding of the flow makes it easier to read

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... ideally the code would be more readable ... but I was not brave enough to do that :D

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you could write some comments for these methods ... I'm just poking in here and trying to piece information together ...

Comment thread ext/rinku/autolink.c
{
static const size_t valid_uris_count = 5;
static const char *valid_uris[] = {
"/", "http://", "https://", "ftp://", "mailto:"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mariozaizar mariozaizar deleted the grosser/docs branch June 23, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants