[PATCH] Skip 1password entries without password

Carlos Mondragon cadragon at gmail.com
Mon Sep 30 06:53:57 CEST 2019


1Password supports entries with no password which makes the import
process crash.
---
 contrib/importers/1password2pass.rb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/contrib/importers/1password2pass.rb b/contrib/importers/1password2pass.rb
index e0ca39b..e8a300e 100755
--- a/contrib/importers/1password2pass.rb
+++ b/contrib/importers/1password2pass.rb
@@ -112,9 +112,13 @@ elsif File.extname(filename) =~ /.1pif/i
 
     pass[:title] = entry[:title]
 
-    pass[:password] = entry[:secureContents][:fields].detect do |field|
+    password = entry[:secureContents][:fields].detect do |field|
       field[:designation] == "password"
-    end[:value]
+    end
+    # 1Password supports entries with no password
+    next unless password
+
+    pass[:password] = password[:value]
 
     username = entry[:secureContents][:fields].detect do |field|
       field[:designation] == "username"
-- 
2.21.0 (Apple Git-122)



More information about the Password-Store mailing list