rubeepass 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88ea712dd5f74c73236a618c5d372fecf37c5d46
4
- data.tar.gz: a1903d7e08f34d93a6b36e1289bbe39e4299c28c
3
+ metadata.gz: 006a68f0d13c9efe8eecf937d1bec8a8c2d067eb
4
+ data.tar.gz: e19d1a9a76ffd938a85feea89d3bc8211a7458c2
5
5
  SHA512:
6
- metadata.gz: 4879ef2590d50c6103e2a4007fc0f954b8bb0b00eeab5a4afcab20e231e4e3254e26f6ecde3c74ea2349418f87aa0c3a1cda7fe24840261f161472b222717cbf
7
- data.tar.gz: 71d1411ad94c214dac2aa250e4fb00e006b4892541c6d4156c3925a8f7e984117885bc3b8904786b063c9bc71c2124f29c657ff7a94ff0770162a78c3a463a69
6
+ metadata.gz: 1b71c2f598f1e5d56575e6faca2dad81f24c790f713218b101467f3982ce3a5cc4b84f6f0815b7b4f8c40cec87b772097a07ce08d523551ed6849d26699d584b
7
+ data.tar.gz: 1f53c5905d5e620f58576789dfeea5617394f278e8196f3bb1d01b23fc48c78704a1c9367dd76a2cb8cae420dba05b83fc77d5d0629e3fdcfbe89dc1a40cc380
@@ -75,7 +75,11 @@ class RubeePass::Entry
75
75
 
76
76
  def password
77
77
  return nil if (@keepass.nil?)
78
- return @keepass.protected_decryptor.get_password(@password)
78
+ begin
79
+ return @keepass.protected_decryptor.get_password(@password)
80
+ rescue
81
+ return @password
82
+ end
79
83
  end
80
84
 
81
85
  def to_s
data/lib/rubeepass.rb CHANGED
@@ -311,7 +311,7 @@ class RubeePass
311
311
  end
312
312
  private :parse_gzip
313
313
 
314
- # Horrible attempt at parsing xml. Someday I might use a library
314
+ # Horrible attempt at parsing xml. Someday I might use a library.
315
315
  def parse_xml
316
316
  curr = Group.new({"Keepass" => self, "Name" => "/"})
317
317
  entry_params = Hash.new
@@ -335,13 +335,7 @@ class RubeePass
335
335
  next
336
336
  when "</Root>"
337
337
  break
338
- when %r{^.*</Value>}
339
- line.gsub!(%r{</Value>$}, "")
340
- entry_params[status] += line if (line && !line.empty?)
341
- if (line && !line.empty?)
342
- entry_params[status] += "\n#{line}"
343
- end
344
-
338
+ when "</Value>"
345
339
  status = nil
346
340
  inside_value = false
347
341
  next
@@ -351,6 +345,13 @@ class RubeePass
351
345
 
352
346
  line = CGI::unescapeHTML(line)
353
347
  line = URI::unescape(line)
348
+ if (!line.valid_encoding?)
349
+ line = line.encode(
350
+ "UTF-16be",
351
+ :invalid=>:replace,
352
+ :replace=>"?"
353
+ ).encode('UTF-8')
354
+ end
354
355
 
355
356
  # Handle values with newlines
356
357
  if (inside_value && !ignore)
@@ -400,7 +401,7 @@ class RubeePass
400
401
  entry_params["UUID"] = uuid
401
402
  end
402
403
  when %r{^<Value>.*}
403
- line.gsub!(%r{<Value>}, "")
404
+ line.gsub!(%r{^<Value>}, "")
404
405
  line = "" if (line.nil?)
405
406
  entry_params[status] = line
406
407
  inside_value = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubeepass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-19 00:00:00.000000000 Z
11
+ date: 2015-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest