mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Escape unescaped semicolons coming out of Route53
This commit is contained in:
@@ -253,10 +253,13 @@ class Route53Provider(BaseProvider):
|
||||
_data_for_PTR = _data_for_single
|
||||
_data_for_CNAME = _data_for_single
|
||||
|
||||
_fix_semicolons = re.compile(r'(?<!\\);')
|
||||
|
||||
def _data_for_quoted(self, rrset):
|
||||
return {
|
||||
'type': rrset['Type'],
|
||||
'values': [rr['Value'][1:-1] for rr in rrset['ResourceRecords']],
|
||||
'values': [self._fix_semicolons.sub('\;', rr['Value'][1:-1])
|
||||
for rr in rrset['ResourceRecords']],
|
||||
'ttl': int(rrset['TTL'])
|
||||
}
|
||||
|
||||
|
||||
@@ -1217,3 +1217,23 @@ class TestRoute53Provider(TestCase):
|
||||
with self.assertRaises(Exception) as ctx:
|
||||
provider.apply(plan)
|
||||
self.assertTrue('modifications' in ctx.exception.message)
|
||||
|
||||
def test_semicolon_fixup(self):
|
||||
provider = Route53Provider('test', 'abc', '123')
|
||||
|
||||
self.assertEquals({
|
||||
'type': 'TXT',
|
||||
'ttl': 30,
|
||||
'values': [
|
||||
'abcd\\; ef\\;g',
|
||||
'hij\\; klm\\;n',
|
||||
],
|
||||
}, provider._data_for_quoted({
|
||||
'ResourceRecords': [{
|
||||
'Value': '"abcd; ef;g"',
|
||||
}, {
|
||||
'Value': '"hij\\; klm\\;n"',
|
||||
}],
|
||||
'TTL': 30,
|
||||
'Type': 'TXT',
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user