fix: display long TXT records as one string in preview#4190
Open
raman1236 wants to merge 1 commit intoStackExchange:mainfrom
Open
fix: display long TXT records as one string in preview#4190raman1236 wants to merge 1 commit intoStackExchange:mainfrom
raman1236 wants to merge 1 commit intoStackExchange:mainfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Now they are displayed as a single string per Opinion #8:
Root Cause
ToComparableNoTTL()(used by the diff engine for both comparison and display) calledtxtutil.EncodeQuoted(), which splits TXT values into 255-octet chunks before quoting.Fix
txtutil.EncodeSingle()that quotes the TXT value as a single string without chunkingToComparableNoTTL()to useEncodeSingle()instead ofEncodeQuoted()prettyzone) continues to useEncodeQuoted()with chunking, as that format is required for DNS wire compatibilityTests
All existing txtutil, diff2, and models tests pass.
Fixes #2834