-
Notifications
You must be signed in to change notification settings - Fork 1k
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
apply skip_prefixes before parsing external link domain #1833
Conversation
struct LinkDef { | ||
file_path: PathBuf, | ||
external_link: String, | ||
domain: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created this struct because I find named fields easier to follow than indexed ones, but I'm happy to switch back to the tuple if that's preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine
9d411c2
to
853ffc2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, do you want to do the strictness change in the same PR?
Any chance you can have a look at #1827 (comment) as well?
struct LinkDef { | ||
file_path: PathBuf, | ||
external_link: String, | ||
domain: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine
let domain = get_link_domain(&external_link)?; | ||
all_links.push((s.file.path.clone(), external_link, domain)); | ||
all_links.push(LinkDef::new(s.file.path.clone(), external_link, domain)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those 2 sections should really be refactored but I'll do that in my branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I tried combining the iterators with chain so there would only need to be one loop, but couldn't get it to work.
Hmm, I think a separate PR would be good, since strictness is a new feature and this one is kinda-sorta bugfixy. |
From Handling improperly formed external links on the forum.
This PR applies
skip_prefixes
before attempting to parse the URL.Sanity check:
Code changes
next
branch?