From 0ea7f964952046356f69b50640413bef95af8105 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sun, 28 Jun 2015 15:09:39 +0200 Subject: [PATCH] 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" --- lib/deb_importer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/deb_importer.rb b/lib/deb_importer.rb index b85dba4..673913a 100644 --- a/lib/deb_importer.rb +++ b/lib/deb_importer.rb @@ -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=''