summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-04-04 22:52:41 +0200
committerlpsolit%gmail.com <>2007-04-04 22:52:41 +0200
commit1afb5b3bb0ac579fdd1616f701b27038feb5a375 (patch)
treefbe744149ea8bb87949f4357b007f6a356415194 /Bugzilla
parent52c8d09da827fbbbc4e7c34eb6c92d1408c64fb0 (diff)
downloadbugzilla-1afb5b3bb0ac579fdd1616f701b27038feb5a375.tar.gz
bugzilla-1afb5b3bb0ac579fdd1616f701b27038feb5a375.tar.xz
Bug 376497: validateID() should return an attachment object - Patch by Frédéric Buclin <LpSolit@gmail.com> a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Attachment.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index cf4f475f6..09dd3c887 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -728,8 +728,8 @@ sub insert_attachment_for_bug {
my $filename;
my $contenttype;
my $isurl;
- $class->validate_is_patch($throw_error) || return 0;
- $class->validate_description($throw_error) || return 0;
+ $class->validate_is_patch($throw_error) || return;
+ $class->validate_description($throw_error) || return;
if (Bugzilla->params->{'allow_attach_url'}
&& ($attachurl =~ /^(http|https|ftp):\/\/\S+/)
@@ -743,16 +743,16 @@ sub insert_attachment_for_bug {
$cgi->delete('bigfile');
}
else {
- $filename = _validate_filename($throw_error) || return 0;
+ $filename = _validate_filename($throw_error) || return;
# need to validate content type before data as
# we now check the content type for image/bmp in _validate_data()
unless ($cgi->param('ispatch')) {
- $class->validate_content_type($throw_error) || return 0;
+ $class->validate_content_type($throw_error) || return;
}
$data = _validate_data($throw_error, $hr_vars);
# If the attachment is stored locally, $data eq ''.
# If an error is thrown, $data eq '0'.
- ($data ne '0') || return 0;
+ ($data ne '0') || return;
$contenttype = $cgi->param('contenttype');
# These are inserted using placeholders so no need to panic
@@ -826,7 +826,7 @@ sub insert_attachment_for_bug {
close AH;
close $fh;
unlink "$attachdir/$hash/attachment.$attachid";
- $throw_error ? ThrowUserError("local_file_too_large") : return 0;
+ $throw_error ? ThrowUserError("local_file_too_large") : return;
}
}
close AH;
@@ -874,8 +874,8 @@ sub insert_attachment_for_bug {
$$hr_vars->{'flag_creation_error'} = $@;
}
- # Return the ID of the new attachment.
- return $attachid;
+ # Return the new attachment object.
+ return $attachment;
}
1;