Skip to content

Commit

Permalink
Fixes #3722: Allow the underscore character in IPAddress DNS names
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Dec 6, 2019
1 parent 9e765b1 commit a97ebc6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/release-notes/version-2.6.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [#3457](https://github.com/netbox-community/netbox/issues/3457) - Display cable colors on device view
* [#3329](https://github.com/netbox-community/netbox/issues/3329) - Remove obsolete P3P policy header
* [#3663](https://github.com/netbox-community/netbox/issues/3663) - Add query filters for `created` and `last_updated` fields
* [#3722](https://github.com/netbox-community/netbox/issues/3722) - Allow the underscore character in IPAddress DNS names

## Bug Fixes

Expand Down
4 changes: 2 additions & 2 deletions netbox/ipam/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


DNSValidator = RegexValidator(
regex='^[0-9A-Za-z.-]+$',
message='Only alphanumeric characters, hyphens, and periods are allowed in DNS names',
regex='^[0-9A-Za-z.-_]+$',
message='Only alphanumeric characters, hyphens, periods, and underscores are allowed in DNS names',
code='invalid'
)

2 comments on commit a97ebc6

@szutman
Copy link

@szutman szutman commented on a97ebc6 Dec 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't valid implementation of #3722, because between period and underscore is hyphen which means range (.-_). I think it would be better like this
regex='^[_0-9A-Za-z.-]+$'
(underscore in the begining of regexp).

Szutman

@jeremystretch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 95edec5, thanks!

Please sign in to comment.