exclude .gpg extension in password name

This commit is contained in:
Bob Sun 2017-01-23 17:53:49 +08:00
parent cb333e7bfb
commit 1964244427
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -105,7 +105,8 @@ class PasswordStore {
if let e = e as? String, let url = URL(string: e) {
if url.pathExtension == "gpg" {
let entity = PasswordEntity(context: context)
entity.name = url.lastPathComponent
let endIndex = url.lastPathComponent.index(url.lastPathComponent.endIndex, offsetBy: -4)
entity.name = url.lastPathComponent.substring(to: endIndex)
entity.rawPath = "password-store/\(url.absoluteString)"
}
}