Skip to content

Commit 07a9c02

Browse files
committed
fix(aws): minor change to normalize name
1 parent fb8b1c5 commit 07a9c02

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/services/route53Record/format.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
import { isEmpty } from 'lodash'
12
import { AwsRoute53Record } from '../../types/generated'
2-
import { RawAwsRoute53Record } from './data'
33
import { getHostedZoneId, getRecordId } from '../../utils/ids'
4+
import { RawAwsRoute53Record } from './data'
45

56
// Normalize name due special chars like '*' are replaced with '\\052'
6-
const normalizeName = (name: string): string =>
7-
name?.replace(/\\052/g, '*').slice(0, -1)
7+
const normalizeName = (name: string): string => {
8+
if (isEmpty(name)) return ''
9+
const normalizedName = name.replace(/\\052/g, '*')
10+
return normalizedName.endsWith('.')
11+
? normalizedName.slice(0, -1)
12+
: normalizedName
13+
}
814

915
/**
1016
* Route53 Record

0 commit comments

Comments
 (0)