Fix 1Password importer so it handles different line endings
---
contrib/importers/1password2pass.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/contrib/importers/1password2pass.rb
b/contrib/importers/1password2pass.rb
index 79318ee..5ea4523 100755
--- a/contrib/importers/1password2pass.rb
+++ b/contrib/importers/1password2pass.rb
@@ -95,8 +95,10 @@ if File.extname(filename) =~ /.txt/i
elsif File.extname(filename) =~ /.1pif/i
require "json"
- # 1PIF is almost JSON, but not quite
pif = "[#{File.open(filename).read}]"
+ # Normalize line endings, explicitly preserving encoding just to be sure
+ pif.encode!(pif.encoding, universal_newline: true)
+ # 1PIF is almost JSON, but not quite:
pif.gsub!(/^\*\*\*.*\*\*\*$/, ",")
pif = JSON.parse(pif, {symbolize_names: true})
--
Tobias V. Langhoff
_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store