Skip to content

Commit b200ce2

Browse files
spliffonespike-rabbit
authored andcommitted
fix(ip-input): allow IPv6 unspecified address
fixes #2183
1 parent 7edec49 commit b200ce2

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

projects/element-ng/ip-input/address-validators.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,5 @@ const validateSubnet = (cidr: string): boolean => {
7171
return subnet > 0 && subnet <= 128;
7272
};
7373

74-
const matchIpV6 = (ip: string): boolean => !!ip.match(ipV6Regex) && !!URL.parse(`http://[${ip}]`);
74+
const matchIpV6 = (ip: string): boolean =>
75+
(ip === '::' || !!ip.match(ipV6Regex)) && !!URL.parse(`http://[${ip}]`);

projects/element-ng/ip-input/si-ip6-input.directive.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ describe('SiIp6InputDirective', () => {
7474
'1::4:5:6:7:8',
7575
'1:2::4:5:6:7:8',
7676
'1::3:4:5:6:7:8',
77-
'1::8'
77+
'1::8',
78+
'::' // Unspecified address
7879
].forEach(i => {
7980
it(`should be valid with input ${i}`, () => {
8081
typeInput(i);

0 commit comments

Comments
 (0)