From 3292bd3652a6e941132c288a71d79c9699a858f2 Mon Sep 17 00:00:00 2001 From: Mingshen Sun Date: Sat, 15 Feb 2025 23:38:23 -0800 Subject: [PATCH] Resolving symlinks in path (#679) --- passKit/Models/PasswordEntity.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/passKit/Models/PasswordEntity.swift b/passKit/Models/PasswordEntity.swift index 26dae9e..8b64d42 100644 --- a/passKit/Models/PasswordEntity.swift +++ b/passKit/Models/PasswordEntity.swift @@ -153,6 +153,7 @@ public final class PasswordEntity: NSManagedObject, Identifiable { public static func initPasswordEntityCoreData(url: URL, in context: NSManagedObjectContext) { let localFileManager = FileManager.default + let url = url.resolvingSymlinksInPath() let root = { let entity = PasswordEntity(context: context) @@ -190,8 +191,7 @@ public final class PasswordEntity: NSManagedObject, Identifiable { } } passwordEntity.parent = current - let path = String(fileURL.path.replacingOccurrences(of: url.path, with: "").drop(while: { $0 == "/" })) - passwordEntity.path = path + passwordEntity.path = String(fileURL.path.dropFirst(url.path.count + 1)) } } context.delete(root)