-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Validate .tld for new feed URLs #325
Validate .tld for new feed URLs #325
Conversation
@artpi had concerns over using the parse-domain library, because it has this list hard-coded: We could perhaps swap it out for a simple check if looks like a .tld (i.e. a dot and at least 2 characters at the end of the string). |
73d245c
to
973657d
Compare
cc @aerych |
} | ||
|
||
return false; | ||
// Check for a valid-looking TLD | ||
const lastHostnameSegment = last( parsedUrl.hostname.split( '.' ) ); |
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 think this is fine, but you could also use lastIndexOf
, compare that to length - 2 (3?), and avoid the allocations that come with split.
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.
Thanks, I like that. Changing now.
…nt-tld-validation Validate .tld for new feed URLs
Ensure that new feed URLs have a valid .tld before allowing the user to follow the feed.
Fixes #96.