Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
best-practical
rt-extension-commandbymail
Commits
43beb6a5
Commit
43beb6a5
authored
Jul 24, 2009
by
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/RT/Interface/Email/Filter/TakeAction.pm
View file @
43beb6a5
...
...
@@ -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
);
}
...
...
t/02.create.t
View file @
43beb6a5
...
...
@@ -3,7 +3,7 @@
use
strict
;
use
warnings
;
use
Test::
More
tests
=>
14
0
;
use
Test::
More
tests
=>
14
4
;
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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment