Skip to content

Commit

Permalink
[#1277] Cosmetic typescript correction
Browse files Browse the repository at this point in the history
  • Loading branch information
msiodelski committed Jan 26, 2024
1 parent 5eb45cc commit df2f20a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions webui/src/app/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,15 +748,14 @@ export class StorkValidators {
if (control.value === null || typeof control.value !== 'string' || control.value.length === 0) {
return null
}
let cidr: string
let incorrect = false
let cidr: string = null
try {
// Is it an IPv6 prefix?
cidr = collapseIPv6Number(IPv6CidrRange.fromCidr(control.value).toCidrString())
} catch (_) {
incorrect = true
// Do nothing here. We'll check it is an IPv4 prefix.
}
if (incorrect) {
if (cidr == null) {
try {
// Maybe it is an IPv4 prefix?
cidr = IPv4CidrRange.fromCidr(control.value).toCidrString()
Expand Down

0 comments on commit df2f20a

Please sign in to comment.