Skip to content

Commit

Permalink
fix: don't lowercase TXT records
Browse files Browse the repository at this point in the history
This is borderline out of scope of aiodnsresolver, but it's a small fix
  • Loading branch information
michalc committed Aug 28, 2023
1 parent d9313ab commit b9f6a33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aiodnsresolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,8 @@ def rdata_expires_at(record, expires_at):
return \
IPv4AddressExpiresAt(record.rdata, expires_at) if record.qtype == TYPES.A else \
IPv6AddressExpiresAt(record.rdata, expires_at) if record.qtype == TYPES.AAAA else \
BytesExpiresAt(record.rdata.lower(), expires_at)
BytesExpiresAt(record.rdata.lower(), expires_at) if record.qtype == TYPES.CNAME else \
BytesExpiresAt(record.rdata, expires_at)

def rdata_expires_at_min(rdatas, expires_at):
return tuple(
Expand Down
2 changes: 2 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,8 @@ async def test_a_query_multiple(self):
async def test_txt_query(self):
resolve, _ = Resolver()
res = await resolve('charemza.name', TYPES.TXT)
all_lowercase = all(r == r.lower() for r in res)
self.assertFalse(all_lowercase)
self.assertIn(b'google', res[0])

@async_test
Expand Down

0 comments on commit b9f6a33

Please sign in to comment.