Fix search issues

This commit is contained in:
Mingshen Sun 2021-01-17 20:47:52 -08:00
parent 68077bf04c
commit 8afc40a5a1
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
2 changed files with 23 additions and 17 deletions

View file

@ -11,8 +11,12 @@ import SwiftyUserDefaults
public extension PasswordEntity {
var nameWithCategory: String {
if let path = path, path.hasSuffix(".gpg") {
return String(path.prefix(upTo: path.index(path.endIndex, offsetBy: -4)))
if let path = path {
if path.hasSuffix(".gpg") {
return String(path.prefix(upTo: path.index(path.endIndex, offsetBy: -4)))
} else {
return path
}
}
return ""
}