Skip to content

fix: display long TXT records as one string in preview#4190

Open
raman1236 wants to merge 1 commit intoStackExchange:mainfrom
raman1236:fix/txt-record-display-no-chunking
Open

fix: display long TXT records as one string in preview#4190
raman1236 wants to merge 1 commit intoStackExchange:mainfrom
raman1236:fix/txt-record-display-no-chunking

Conversation

@raman1236
Copy link
Copy Markdown

Description

Fixes the confusing display of long TXT records in the preview/diff output. Previously, TXT records longer than 255 octets were shown as chunked segments:

"v=DKIM1; k=rsa; p=MIIB...long..." "remaining..."

Now they are displayed as a single string per Opinion #8:

"v=DKIM1; k=rsa; p=MIIB...long...remaining..."

Root Cause

ToComparableNoTTL() (used by the diff engine for both comparison and display) called txtutil.EncodeQuoted(), which splits TXT values into 255-octet chunks before quoting.

Fix

  • Added txtutil.EncodeSingle() that quotes the TXT value as a single string without chunking
  • Changed ToComparableNoTTL() to use EncodeSingle() instead of EncodeQuoted()
  • Zone file output (prettyzone) continues to use EncodeQuoted() with chunking, as that format is required for DNS wire compatibility

Tests

All existing txtutil, diff2, and models tests pass.

Fixes #2834

The preview/diff output previously showed long TXT records as
255-octet chunks (e.g., "255chars" "255chars" "rest"), which
is confusing to users and violates Opinion StackExchange#8 (TXT records are
one long string).

Add EncodeSingle() to txtutil that quotes the TXT value without
splitting into 255-octet chunks, and use it in ToComparableNoTTL()
so that the diff preview shows TXT records as a single string.

The zone file output (prettyzone) continues to use EncodeQuoted()
with chunking, as that format is required for zone file syntax.

Fixes StackExchange#2834
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display of long TXT record changes is confusing

2 participants