summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Attachment.pm
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2005-02-21 02:03:09 +0100
committerbugreport%peshkin.net <>2005-02-21 02:03:09 +0100
commit30a52319c024fefb2b4e4aa7bd974e4af7af30cd (patch)
tree4ee72b234e27753d291454020d97cc03e8f51a94 /Bugzilla/Attachment.pm
parentc1d16e426c2d1f2fe5563c0d20b3b8eb256d8c77 (diff)
downloadbugzilla-30a52319c024fefb2b4e4aa7bd974e4af7af30cd.tar.gz
bugzilla-30a52319c024fefb2b4e4aa7bd974e4af7af30cd.tar.xz
Bug 252272: Allow extremely large attachments to be stored locally
r=wurblzap.a=justdave
Diffstat (limited to 'Bugzilla/Attachment.pm')
-rw-r--r--Bugzilla/Attachment.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index e7b3ffe86..5f491f315 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -33,6 +33,7 @@ package Bugzilla::Attachment;
# Use the Flag module to handle flags.
use Bugzilla::Flag;
+use Bugzilla::Config qw(:locations);
############################################################################
# Functions
@@ -92,6 +93,17 @@ sub query
# Retrieve a list of flags for this attachment.
$a{'flags'} = Bugzilla::Flag::match({ 'attach_id' => $a{'attachid'},
'is_active' => 1 });
+
+ # A zero size indicates that the attachment is stored locally.
+ if ($a{'datasize'} == 0) {
+ my $attachid = $a{'attachid'};
+ my $hash = ($attachid % 100) + 100;
+ $hash =~ s/.*(\d\d)$/group.$1/;
+ if (open(AH, "$attachdir/$hash/attachment.$attachid")) {
+ $a{'datasize'} = (stat(AH))[7];
+ close(AH);
+ }
+ }
# We will display the edit link if the user can edit the attachment;
# ie the are the submitter, or they have canedit.