Skip to content

Commit

Permalink
Allow >1 underscore in hostnames, closes #510
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Feb 29, 2016
1 parent a7bc8b4 commit a1c8dab
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 12 deletions.
3 changes: 0 additions & 3 deletions lib/isFQDN.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ function isFDQN(str, options) {
for (var part, i = 0; i < parts.length; i++) {
part = parts[i];
if (options.allow_underscores) {
if (part.indexOf('__') >= 0) {
return false;
}
part = part.replace(/_/g, '');
}
if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) {
Expand Down
3 changes: 0 additions & 3 deletions src/lib/isFQDN.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export default function isFDQN(str, options) {
for (let part, i = 0; i < parts.length; i++) {
part = parts[i];
if (options.allow_underscores) {
if (part.indexOf('__') >= 0) {
return false;
}
part = part.replace(/_/g, '');
}
if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) {
Expand Down
3 changes: 1 addition & 2 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,9 @@ describe('Validators', function () {
valid: [
'http://foo_bar.com',
'http://pr.example_com.294.example.com/',
],
invalid: [
'http://foo__bar.com',
],
invalid: [],
});
});

Expand Down
3 changes: 0 additions & 3 deletions validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@
for (var part, i = 0; i < parts.length; i++) {
part = parts[i];
if (options.allow_underscores) {
if (part.indexOf('__') >= 0) {
return false;
}
part = part.replace(/_/g, '');
}
if (!/^[a-z\u00a1-\uffff0-9-]+$/i.test(part)) {
Expand Down
2 changes: 1 addition & 1 deletion validator.min.js

Large diffs are not rendered by default.

0 comments on commit a1c8dab

Please sign in to comment.