@@ -57,7 +57,11 @@ function Get-YamlNodeFingerprint {
5757
5858 if ($effective.Kind -eq ' Scalar' ) {
5959 $resolved = Resolve-YamlScalar - Node $effective
60- $fingerprint = Get-YamlScalarFingerprint - Value $resolved.Value - Hasher $Hasher
60+ $valueFingerprint = Get-YamlScalarFingerprint - Value $resolved.Value - Hasher $Hasher
61+ $effectiveTag = Get-YamlEffectiveTag - Node $effective - Value $resolved.Value
62+ $fingerprint = Get-YamlFingerprintHash - Value (
63+ ' scalar:{0}:{1}:{2}' -f $effectiveTag.Length , $effectiveTag , $valueFingerprint
64+ ) - Hasher $Hasher
6165 $Cache [$effective.Id ] = $fingerprint
6266 [void ] $Active.Remove ($effective.Id )
6367 $frame.Holder.Value = $fingerprint
@@ -76,15 +80,12 @@ function Get-YamlNodeFingerprint {
7680
7781 if ($frame.State -eq ' Sequence' ) {
7882 if ($frame.Index -ge $frame.Node.Items.Count ) {
79- $semanticTag = if (
80- $frame.Node.Tag -ceq ' tag:yaml.org,2002:omap' -or
81- $frame.Node.Tag -ceq ' tag:yaml.org,2002:pairs'
82- ) {
83- $frame.Node.Tag
84- } else {
85- ' tag:yaml.org,2002:seq'
86- }
87- $canonical = ' sequence:{0}:{1}' -f $semanticTag , ($frame.Parts -join ' |' )
83+ $semanticTag = Get-YamlEffectiveTag - Node $frame.Node - Value $null
84+ $canonical = ' sequence:{0}:{1}:{2}' -f @ (
85+ $semanticTag.Length ,
86+ $semanticTag ,
87+ ($frame.Parts -join ' |' )
88+ )
8889 $fingerprint = Get-YamlFingerprintHash - Value $canonical - Hasher $Hasher
8990 $Cache [$frame.Node.Id ] = $fingerprint
9091 [void ] $Active.Remove ($frame.Node.Id )
@@ -115,12 +116,12 @@ function Get-YamlNodeFingerprint {
115116 if ($frame.State -eq ' MappingKey' ) {
116117 if ($frame.Index -ge $frame.Node.Entries.Count ) {
117118 $frame.Parts.Sort ([System.StringComparer ]::Ordinal)
118- $mappingTag = if ( $frame.Node.Tag -ceq ' tag:yaml.org,2002:set ' ) {
119- $frame .Node.Tag
120- } else {
121- ' tag:yaml.org,2002:map '
122- }
123- $canonical = ' mapping:{0}:{1} ' -f $mappingTag , ( $frame .Parts -join ' | ' )
119+ $mappingTag = Get-YamlEffectiveTag - Node $frame.Node - Value $null
120+ $canonical = ' mapping:{0}:{1}:{2} ' -f @ (
121+ $mappingTag .Length ,
122+ $mappingTag ,
123+ ( $frame .Parts -join ' | ' )
124+ )
124125 $fingerprint = Get-YamlFingerprintHash - Value $canonical - Hasher $Hasher
125126 $Cache [$frame.Node.Id ] = $fingerprint
126127 [void ] $Active.Remove ($frame.Node.Id )
0 commit comments