Commit 43beb6a5 authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Be looser in what we accept, so that CFs with spaces match

Previously, CustomField.{Foo Bar} wouldn't be matched
parent 1936cde3
......@@ -187,7 +187,7 @@ sub GetCurrentUser {
my $body = $part->bodyhandle or next;
#if it looks like it has pseudoheaders, that's our content
if ( $body->as_string =~ /^(?:\S+):/m ) {
if ( $body->as_string =~ /^(?:\S+)(?:{.*})?:/m ) {
@content = $body->as_lines;
last;
}
......@@ -197,7 +197,7 @@ sub GetCurrentUser {
my $found_pseudoheaders = 0;
foreach my $line (@content) {
next if $line =~ /^\s*$/ && ! $found_pseudoheaders;
last if $line !~ /^(?:(\S+)\s*?:\s*?(.*)\s*?|)$/;
last if $line !~ /^(?:(\S+(?:{.*})?)\s*?:\s*?(.*)\s*?|)$/;
$found_pseudoheaders = 1;
push( @items, $1 => $2 );
}
......
......@@ -3,7 +3,7 @@
use strict;
use warnings;
use Test::More tests => 140;
use Test::More tests => 144;
BEGIN { require 't/utils.pl' }
RT::Init();
......@@ -266,6 +266,30 @@ END
is($obj->FirstCustomFieldValue($cf_name), 'foo', 'correct cf value' );
}
diag("set custom fields with whitespace on create") if $ENV{'TEST_VERBOSE'};
{
require RT::CustomField;
my $cf = RT::CustomField->new( $RT::SystemUser );
my $cf_name = 'te st'.rand $$;
$cf->Create( Name => $cf_name, Queue => 0, Type => 'Freeform' );
ok($cf->id, "created global CF");
my $text = <<END;
Subject: test
From: root\@localhost
CustomField.{$cf_name}: foo
test
END
my $id = create_ticket_via_gate( $text );
ok($id, "created ticket");
my $obj = RT::Ticket->new( $RT::SystemUser );
$obj->Load( $id );
is($obj->id, $id, "loaded ticket");
is($obj->FirstCustomFieldValue($cf_name), 'foo', 'correct cf value' );
}
diag("accept watcher as username and email address") if $ENV{'TEST_VERBOSE'};
{
require RT::Queue;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment