better regex matchnig behavior

This commit is contained in:
Graham Knop 2007-10-05 19:57:38 +00:00
parent f715c29c67
commit 9167097d11
2 changed files with 10 additions and 11 deletions

View file

@ -236,8 +236,10 @@ sub parseParts {
my $body = $message->bodyhandle; my $body = $message->bodyhandle;
if (defined $body) { if (defined $body) {
my $disposition = $message->head->get("Content-Disposition"); my $disposition = $message->head->get("Content-Disposition");
$disposition =~ m/filename=\"(.*)\"/; my $filename = "";
my $filename = $1; if($disposition =~ m/filename=\"(.*)\"/) {
$filename = $1;
}
return [{content => $body->as_string, type=>$type, filename=>$filename}]; return [{content => $body->as_string, type=>$type, filename=>$filename}];
} }
my @parts = (); my @parts = ();

View file

@ -115,8 +115,8 @@ sub addPost {
content=>$content, content=>$content,
ownerUserId=>$user->userId, ownerUserId=>$user->userId,
username=>$user->profileField("alias") || $user->username, username=>$user->profileField("alias") || $user->username,
originalEmail=>join("",@{$message->{rawMessage}}) originalEmail=>join("",@{$message->{rawMessage}}),
}); });
if (scalar(@attachments)) { if (scalar(@attachments)) {
my $storage = $post->getStorageLocation; my $storage = $post->getStorageLocation;
foreach my $file (@attachments) { foreach my $file (@attachments) {
@ -176,13 +176,11 @@ sub execute {
return $self->COMPLETE unless (defined $mail); return $self->COMPLETE unless (defined $mail);
my $i18n = WebGUI::International->new($self->session, "Asset_Collaboration"); my $i18n = WebGUI::International->new($self->session, "Asset_Collaboration");
my $postGroup = $cs->get("postGroupId"); #group that's allowed to post to the CS my $postGroup = $cs->get("postGroupId"); #group that's allowed to post to the CS
while (my $message = $mail->getNextMessage) { while (my $message = $mail->getNextMessage) {
next unless (scalar(@{$message->{parts}})); # no content, skip it next unless (scalar(@{$message->{parts}})); # no content, skip it
my $from = $message->{from}; my $from = $message->{from};
$from =~ /<(\S+\@\S+)>/; $from =~ s/<(\S+\@\S+)>/$1/;
$from = $1 || $from;
$from =~ /(\S+\@\S+)/;
my $user = WebGUI::User->newByEmail($self->session, $from); #instantiate the user by email my $user = WebGUI::User->newByEmail($self->session, $from); #instantiate the user by email
unless (defined $user) { #if no user unless (defined $user) { #if no user
@ -209,9 +207,8 @@ sub execute {
} }
my $post = undef; my $post = undef;
if ($message->{inReplyTo}) { if ($message->{inReplyTo} && $message->{inReplyTo} =~ m/cs\-([\w_-]{22})\@/) {
$message->{inReplyTo} =~ m/cs\-([\w_-]{22})\@/; my $id = $1;
my $id = $1;
$post = WebGUI::Asset->newByDynamicClass($self->session, $id); $post = WebGUI::Asset->newByDynamicClass($self->session, $id);
} }