Skip to content

Commit

Permalink
Disallow full-width chars in domain names, closes #343
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Aug 1, 2015
1 parent c89c271 commit 7384f32
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe('Validators', function () {
, '@invalid.com'
, '[email protected].'
, '[email protected].'
, 'somename@gmail.com'
, 'hans.m端[email protected]'
, '[email protected]'
]
Expand Down
4 changes: 4 additions & 0 deletions validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@
if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) {
return false;
}
if (/[\uff01-\uff5e]/.test(part)) {
// disallow full-width chars
return false;
}
if (part[0] === '-' || part[part.length - 1] === '-' ||
part.indexOf('---') >= 0) {
return false;
Expand Down
Loading

0 comments on commit 7384f32

Please sign in to comment.