Add GuidFormats option to ScrubInlineGuids

Merged
SI
4mo ago
+166-14

Fixes #1822

Problem

ScrubInlineGuids matches both D format (00000000-0000-0000-0000-000000000000) and N format (00000000000000000000000000000000) guids. Since any 32 character hex sequence is a valid N format guid, hex content of that exact length (an MD5 hash for example) is also scrubbed. There was no way to opt out of N matching while keeping D.

Change

Add a GuidFormats flags enum and new ScrubInlineGuids overloads that accept it:

// Only scrub dashed "D" format guids; 32 char hex hashes are left untouched
.ScrubInlineGuids(GuidFormats.Dashed)
  • GuidFormats = Dashed (the D format, which also covers B/P) | Undashed (the N format) | All.
  • The existing parameterless / extension-only signatures are left untouched; the format selection is exposed as added overloads rather than an optional parameter, so this is not a binary breaking change (an optional parameter would change the existing method signatures and break callers compiled against them with MissingMethodException).
  • Applied consistently across all entry points: instance / global × plain / extension-mapped, plus the fluent SettingsTask wrappers. A shared GuidMatcher.ForFormats helper preserves the existing D-then-N scrubber order, and the original methods now delegate to GuidFormats.All.

Tests & docs

  • Added tests proving GuidFormats.Dashed leaves an N format hash untouched, and GuidFormats.Undashed leaves a D format guid untouched.
  • Documented the new option in docs/mdsource/guids.source.md and regenerated docs/guids.md.