[PATCH v2] Skip 1password entries without password

Carlos Mondragon cadragon at gmail.com
Wed Oct 2 18:26:18 CEST 2019


1Password supports entries with no password which makes the import
process crash.
---
 As suggested instead of skipping the entry we are adding it with an
 emtpy password. Seems like a better approach than just skipping the
 entry.

 contrib/importers/1password2pass.rb | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/contrib/importers/1password2pass.rb b/contrib/importers/1password2pass.rb
index e0ca39b..1f1677d 100755
--- a/contrib/importers/1password2pass.rb
+++ b/contrib/importers/1password2pass.rb
@@ -112,9 +112,16 @@ 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
+
+    if password
+      pass[:password] = password[:value]
+    else
+      pass[:password] = ""
+      puts "Warning: Entry with an empty password #{entry[:title]}"
+    end
 
     username = entry[:secureContents][:fields].detect do |field|
       field[:designation] == "username"
-- 
2.21.0 (Apple Git-122)



More information about the Password-Store mailing list