Skip to content

Commit 3292bd3

Browse files
authored
Resolving symlinks in path (#679)
1 parent 1e79e12 commit 3292bd3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

passKit/Models/PasswordEntity.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ public final class PasswordEntity: NSManagedObject, Identifiable {
153153

154154
public static func initPasswordEntityCoreData(url: URL, in context: NSManagedObjectContext) {
155155
let localFileManager = FileManager.default
156+
let url = url.resolvingSymlinksInPath()
156157

157158
let root = {
158159
let entity = PasswordEntity(context: context)
@@ -190,8 +191,7 @@ public final class PasswordEntity: NSManagedObject, Identifiable {
190191
}
191192
}
192193
passwordEntity.parent = current
193-
let path = String(fileURL.path.replacingOccurrences(of: url.path, with: "").drop(while: { $0 == "/" }))
194-
passwordEntity.path = path
194+
passwordEntity.path = String(fileURL.path.dropFirst(url.path.count + 1))
195195
}
196196
}
197197
context.delete(root)

0 commit comments

Comments
 (0)