fix(artifacts): read keyed archive dictionaries keyed UID as dictionaries
Foundation encodes `encode(_:forKey: "UID")` as a `$top` dictionary whose single key is `UID`. The keyed archive projection treated every one-key `UID`/`CF$UID` dictionary as a reference marker, so that root became a malformed reference and the real link to its object was lost. Treat a one-key dictionary as a UID only when its value is a number, matching the binary decoder's UID shape and Foundation's XML `CF$UID` rule; otherwise descend into it as an ordinary dictionary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
676959ecb5
commit
35c82b93eb
@@ -0,0 +1,7 @@
|
||||
import Foundation
|
||||
|
||||
// Encode the root under a key that matches the UID marker spelling.
|
||||
let archiver = NSKeyedArchiver(requiringSecureCoding: false)
|
||||
archiver.encode("payload" as NSString, forKey: "UID")
|
||||
archiver.finishEncoding()
|
||||
try archiver.encodedData.write(to: URL(fileURLWithPath: CommandLine.arguments[1]))
|
||||
Reference in New Issue
Block a user