summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Attachment.pm12
-rw-r--r--Bugzilla/Config/Attachment.pm5
2 files changed, 11 insertions, 6 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index 350adfd72..00c7ee470 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -339,16 +339,16 @@ sub datasize {
# If we have already retrieved the data, return its size.
return length($self->{data}) if exists $self->{data};
- ($self->{datasize}) =
+ $self->{datasize} =
Bugzilla->dbh->selectrow_array("SELECT LENGTH(thedata)
FROM attach_data
WHERE id = ?",
- undef,
- $self->{id});
+ undef, $self->{id}) || 0;
- # If there's no attachment data in the database, the attachment
- # is stored in a local file, so retrieve its size from the file.
- if ($self->{datasize} == 0) {
+ # If there's no attachment data in the database, either the attachment
+ # is stored in a local file, and so retrieve its size from the file,
+ # or the attachment has been deleted.
+ unless ($self->{datasize}) {
if (open(AH, $self->_get_local_filename())) {
binmode AH;
$self->{datasize} = (stat(AH))[7];
diff --git a/Bugzilla/Config/Attachment.pm b/Bugzilla/Config/Attachment.pm
index 449908528..bbaaaa63d 100644
--- a/Bugzilla/Config/Attachment.pm
+++ b/Bugzilla/Config/Attachment.pm
@@ -41,6 +41,11 @@ sub get_param_list {
my $class = shift;
my @param_list = (
{
+ name => 'allow_attachment_deletion',
+ type => 'b',
+ default => 0
+ },
+ {
name => 'allow_attach_url',
type => 'b',
default => 0