From 6253305b511a0d1f058cbdf5fbc365fdc15f0003 Mon Sep 17 00:00:00 2001 From: tetragon Date: Fri, 19 Oct 2007 02:04:13 +0000 Subject: Check for a filename before trying to filter it git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1792 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Mailer.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'LedgerSMB/Mailer.pm') diff --git a/LedgerSMB/Mailer.pm b/LedgerSMB/Mailer.pm index 6ff22c62..a650d4e1 100644 --- a/LedgerSMB/Mailer.pm +++ b/LedgerSMB/Mailer.pm @@ -125,10 +125,14 @@ sub attach { carp "Message not prepared" unless ref $self->{_message}; # strip path from output name - my $file = $args{filename}; - my $strip = quotemeta $args{strip}; - $file =~ s/(.*\/|$strip)//g; - + my $file; + if ($args{filename}) { + my $strip = quotemeta $args{strip}; + $file = $args{filename}; + $file =~ s/(.*\/|$strip)//g; + } + + # handle both string and file types of input my @data; if ($args{data}) { @data = ('Data', $args{data}); -- cgit v1.2.3