Skip to content

Commit

Permalink
Allow leading underscores in domains ✅
Browse files Browse the repository at this point in the history
  • Loading branch information
wotschofsky committed Dec 9, 2024
1 parent af0bb3d commit d1adddd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const isValidDomain = (domain: string) => {
// Check total length (maximum 253 characters)
if (domain.length > 253 || domain.length === 0) return false;

// Remove wildcard prefix & trailing dot (if fully qualified domain name)
const cleanedDomain = domain.replace(/^\*\./, '').replace(/\.$/, '');
// Remove wildcard prefix or leading underscore, trailing dot (if fully qualified domain name)
const cleanedDomain = domain.replace(/^(\*\.)|_/, '').replace(/\.$/, '');

// Split domain into labels
const labels = cleanedDomain.split('.');
Expand Down

0 comments on commit d1adddd

Please sign in to comment.