Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 890342 - [SMS] LinkHelper regression: misrecognized links #10844

Merged
merged 1 commit into from Jul 9, 2013

Conversation

arcturus
Copy link
Contributor

@arcturus arcturus commented Jul 8, 2013

No description provided.

var parts = domain.split('.');
var lastPart = parts[parts.length - 1];
// We want the last part not to be a number
return lastPart.length > 1 && isNaN(lastPart);
Copy link
Contributor

Choose a reason for hiding this comment

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

isNaN is not what you want here. For example isNaN('') is false :-)

I think you can try !isFinite(lastPart).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip!

I was checking the isFinite function and appreciated some nice behaviours:

isFinite(' 3 ') is true meanwhile isNaN(' 3 ') is false.

Anyway, as you comment, what we need here to ensure this works is !isFinite(lastPart)

@arcturus
Copy link
Contributor Author

arcturus commented Jul 9, 2013

Errors in travis are not related to this PR :(

Merging

arcturus added a commit that referenced this pull request Jul 9, 2013
Bug 890342 - [SMS] LinkHelper regression: misrecognized links
@arcturus arcturus merged commit 3ec4322 into mozilla-b2g:master Jul 9, 2013
@arcturus arcturus deleted the bug-890342 branch July 9, 2013 14:51
arcturus added a commit that referenced this pull request Jul 10, 2013
Bug 890342 - [SMS] LinkHelper regression: misrecognized links
(cherry picked from commit 3ec4322)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants