From 74adb7b6134e8aead318ba9210fc73599d569ee2 Mon Sep 17 00:00:00 2001 From: Olli Vanhoja Date: Wed, 24 Aug 2016 07:19:19 +0300 Subject: [PATCH] Don't use domain-regex It's broken, it doesn't match what you think it will match. --- lib/alias.js | 3 +-- lib/domains.js | 3 +-- package.json | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/alias.js b/lib/alias.js index ae9543d..0e1b060 100644 --- a/lib/alias.js +++ b/lib/alias.js @@ -2,11 +2,10 @@ import Now from './'; import toHost from './to-host'; import chalk from 'chalk'; import isZeitWorld from './is-zeit-world'; -import _domainRegex from 'domain-regex'; import { DOMAIN_VERIFICATION_ERROR } from './errors'; import { resolve4 } from './dns'; -const domainRegex = _domainRegex(); +const domainRegex = /^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}$/; export default class Alias extends Now { diff --git a/lib/domains.js b/lib/domains.js index 0490d60..0f620d9 100644 --- a/lib/domains.js +++ b/lib/domains.js @@ -1,10 +1,9 @@ import Now from '../lib'; import isZeitWorld from './is-zeit-world'; -import _domainRegex from 'domain-regex'; import chalk from 'chalk'; import { DNS_VERIFICATION_ERROR } from './errors'; -const domainRegex = _domainRegex(); +const domainRegex = /^((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}$/; export default class Domains extends Now { diff --git a/package.json b/package.json index 61b9b03..0b5188a 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,6 @@ "copy-paste": "1.3.0", "cross-spawn-async": "2.2.4", "docker-file-parser": "0.1.0", - "domain-regex": "0.0.1", "email-prompt": "0.1.8", "email-validator": "1.0.4", "fs-promise": "0.5.0",