From: Tollef Fog Heen Date: Mon, 4 Jun 2012 20:38:15 +0000 (+0200) Subject: Allow comments at start of file, before access line X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8d1f39f679cc9af195df3e0ecd9cf58642b2122;p=pwstore Allow comments at start of file, before access line --- diff --git a/pws b/pws index 827a678..3790b4f 100755 --- a/pws +++ b/pws @@ -410,10 +410,14 @@ class EncryptedFile end def EncryptedFile.targets(text) - metaline = text.split("\n").first - m = /^access: (.*)/.match metaline - return [] unless m - return m[1].strip.split(/[\t ,]+/) + text.split("\n").each do |line| + if /^#/.match line + next + end + m = /^access: (.*)/.match line + return [] unless m + return m[1].strip.split(/[\t ,]+/) + end end