From 73d245c45781b77d977d0958d467db012ab5123a Mon Sep 17 00:00:00 2001 From: bluefuton Date: Tue, 24 Nov 2015 11:37:08 +0000 Subject: [PATCH] Following Management: check for a valid-looking .tld before activating new feed URL input --- client/reader/following-edit/subscribe-form.jsx | 7 ++++--- package.json | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/reader/following-edit/subscribe-form.jsx b/client/reader/following-edit/subscribe-form.jsx index f93199826d2f61..e8f8b2bbc48aa7 100644 --- a/client/reader/following-edit/subscribe-form.jsx +++ b/client/reader/following-edit/subscribe-form.jsx @@ -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' ), @@ -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; } diff --git a/package.json b/package.json index de71d6d99e69c5..a42fe318c55d42 100644 --- a/package.json +++ b/package.json @@ -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",