Parse keywords from Debian control file in a non-greedy way

Previously this:
Description: foo: bar
had been parsed into
"Description: foo" -> "bar"

Now it properly parses into
"Description" -> "foo: bar"
This commit is contained in:
Christoph Haas 2015-06-28 15:09:39 +02:00
parent 56f38bcdcf
commit 0ea7f96495

View file

@ -101,10 +101,10 @@ module DebImporter
name=value=''
data.each_line do |line|
case line
when /^(.+): (.+)/ # "Key: Value"
when /^(.+?): (.+)/ # "Key: Value"
fields[name.to_sym]=value unless value.empty?
name,value=$1,$2
when /^(.+):$/ # "Key:" (start of multi-line entry without value in line)
when /^(.+?):$/ # "Key:" (start of multi-line entry without value in line)
fields[name.to_sym]=value unless value.empty?
name=$1
value=''