Update the parsers for the RFC822-style key-value lists. Allow a hyphen in
key names. Previously, the "Backup-Intent" field was being ignored because
its name was considered invalid; this change should fix that.
while (defined($line = <DESCRIPTOR>)) {
chomp $line;
- if ($line =~ m/^(\w+):\s*(.*)$/) {
+ if ($line =~ m/^([-\w]+):\s*(.*)$/) {
$descriptor{$1} = $2;
$last_key = $1;
} elsif ($line =~/^\s/ && defined $last_key) {
# Try to parse the data as "key: value" pairs of file metadata. Also
# handle continuation lines, which start with whitespace and continue
# the previous "key: value" pair.
- if ($line =~ m/^(\w+):\s*(.*)$/) {
+ if ($line =~ m/^([-\w]+):\s*(.*)$/) {
$info{$1} = $2;
$last_key = $1;
} elsif ($line =~/^\s/ && defined $last_key) {
# lines.
chomp $line;
- if ($line =~ m/^(\w+):\s*(.*)$/) {
+ if ($line =~ m/^([-\w]+):\s*(.*)$/) {
$descriptor{$1} = $2;
$last_key = $1;
} elsif ($line =~/^\s/ && defined $last_key) {
last_key = None
continue
- m = re.match(r"^(\w+):\s*(.*)$", l)
+ m = re.match(r"^([-\w]+):\s*(.*)$", l)
if m:
dict[m.group(1)] = m.group(2)
last_key = m.group(1)