Resolving symlinks in path (#679)

This commit is contained in:
Mingshen Sun 2025-02-15 23:38:23 -08:00 committed by GitHub
parent 1e79e12593
commit 3292bd3652
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)