Keep the first line as the password even if it is empty
This commit is contained in:
parent
3ffbf68ab8
commit
867a59b513
1 changed files with 3 additions and 3 deletions
|
|
@ -87,15 +87,15 @@ public class Password {
|
||||||
additions.removeAll()
|
additions.removeAll()
|
||||||
|
|
||||||
// split the plain text
|
// split the plain text
|
||||||
let plainTextSplit = self.plainText.split(omittingEmptySubsequences: true) {
|
let plainTextSplit = self.plainText.split(omittingEmptySubsequences: false) {
|
||||||
$0 == "\n" || $0 == "\r\n"
|
$0 == "\n" || $0 == "\r\n"
|
||||||
}.map(String.init)
|
}.map(String.init)
|
||||||
|
|
||||||
// get password
|
// get password
|
||||||
password = plainTextSplit.first ?? ""
|
password = plainTextSplit.first ?? ""
|
||||||
|
|
||||||
// get remaining lines
|
// get remaining lines (filter out empty lines)
|
||||||
let additionalLines = plainTextSplit[1...]
|
let additionalLines = plainTextSplit[1...].filter { !$0.isEmpty }
|
||||||
|
|
||||||
// separate normal lines (no otp tokens)
|
// separate normal lines (no otp tokens)
|
||||||
let normalAdditionalLines = additionalLines.filter {
|
let normalAdditionalLines = additionalLines.filter {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue