Skip to content

Commit

Permalink
Following Management: check for a valid-looking .tld before activatin…
Browse files Browse the repository at this point in the history
…g new feed URL input
  • Loading branch information
bluefuton committed Nov 24, 2015
1 parent 56d6645 commit 73d245c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 4 additions & 3 deletions client/reader/following-edit/subscribe-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const debug = require( 'debug' )( 'calypso:reader:following:edit' ); // eslint-d
const React = require( 'react' ),
url = require( 'url' ),
noop = require( 'lodash/utility/noop' ),
parseDomain = require( 'parse-domain' );
last = require( 'lodash/array/last' );

// Internal dependencies
const Search = require( 'components/search' ),
Expand Down Expand Up @@ -103,8 +103,9 @@ var FollowingEditSubscribeForm = React.createClass( {
return false;
}

// Parse the domain to check for a valid TLD
if ( ! parseDomain( parsedUrl.hostname ) ) {
// Check for a valid-looking TLD
const lastHostnameSegment = last( parsedUrl.hostname.split( '.' ) );
if ( ! lastHostnameSegment || lastHostnameSegment.length < 2 ) {
return false;
}

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"morgan": "1.2.0",
"node-sass": "3.3.3",
"page": "1.6.1",
"parse-domain": "0.2.0",
"phone": "git+https://github.com/Automattic/node-phone.git#1.0.4-6",
"photon": "1.0.4",
"q": "1.0.1",
Expand Down

0 comments on commit 73d245c

Please sign in to comment.