From 21fc834fd9732d4d8cc09c065611ed15ca272e31 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Fri, 12 Sep 2025 18:52:17 -0700 Subject: [PATCH] Fix incorrect deletion of tracked files in public key standin folder. (#696) --- .../Sources/SecretKit/PublicKeyStandinFileController.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift b/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift index 49983d2..49e417e 100644 --- a/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift +++ b/Sources/Packages/Sources/SecretKit/PublicKeyStandinFileController.swift @@ -19,9 +19,10 @@ public final class PublicKeyFileStoreController: Sendable { public func generatePublicKeys(for secrets: [AnySecret], clear: Bool = false) throws { logger.log("Writing public keys to disk") if clear { - let validPaths = Set(secrets.map { publicKeyPath(for: $0) }).union(Set(secrets.map { sshCertificatePath(for: $0) })) + let validPaths = Set(secrets.map { publicKeyPath(for: $0) }) + .union(Set(secrets.map { sshCertificatePath(for: $0) })) let contentsOfDirectory = (try? FileManager.default.contentsOfDirectory(atPath: directory.path())) ?? [] - let fullPathContents = contentsOfDirectory.map { "\(directory)/\($0)" } + let fullPathContents = contentsOfDirectory.map { directory.appending(path: $0).path() } let untracked = Set(fullPathContents) .subtracting(validPaths)