[Bps-public-commit] rt-extension-externalstorage branch, master, updated. 0.60
Alex Vandiver
alexmv at bestpractical.com
Tue Jan 20 15:13:43 EST 2015
The branch, master has been updated
via 246db580f4d1d73b182128f59d1ee0255828a89f (commit)
via 891667ecac2b12fcb5376bd916dfc71411fff889 (commit)
via 788dfff2bc191ed1f2c66b955978bd0485d2ca95 (commit)
from 146aae01ce1cedfe5ee762b9bf84d384df738e06 (commit)
Summary of changes:
Changes | 3 +++
META.yml | 2 +-
lib/RT/Extension/ExternalStorage.pm | 18 +++++++++++-------
3 files changed, 15 insertions(+), 8 deletions(-)
- Log -----------------------------------------------------------------
commit 788dfff2bc191ed1f2c66b955978bd0485d2ca95
Author: Christian Loos <cloos at netcologne.de>
Date: Tue Jan 20 15:29:57 2015 +0100
Don't extract attachments and OCFVs with empty content
Sometimes broken attachments (with empty content) land in the database.
There is no need to extract those attachments, as the content is empty
and doesn't occupy any database space. In fact, extracting them
increases the database size, as the empty content must be replaced by
the 64 byte content fingerprint. This also applies to external
ObjectCustomFieldValues.
Leave 0-length attachments and OCFVs in the database.
diff --git a/lib/RT/Extension/ExternalStorage.pm b/lib/RT/Extension/ExternalStorage.pm
index a1e53ff..7e6bc58 100644
--- a/lib/RT/Extension/ExternalStorage.pm
+++ b/lib/RT/Extension/ExternalStorage.pm
@@ -214,13 +214,13 @@ package RT::ObjectCustomFieldValue;
sub StoreExternally {
my $self = shift;
my $type = $self->CustomFieldObj->Type;
+ my $length = length($self->LargeContent || '');
+
+ return 0 if $length == 0;
return 1 if $type eq "Binary";
- if ($type eq "Image") {
- my $length = length($self->LargeContent || '');
- return 1 if $length > 10 * 1024 * 1024;
- }
+ return 1 if $type eq "Image" and $length > 10 * 1024 * 1024;
return 0;
}
@@ -230,15 +230,19 @@ package RT::Attachment;
sub StoreExternally {
my $self = shift;
my $type = $self->ContentType;
+ my $length = $self->ContentLength;
+
+ return 0 if $length == 0;
+
if ($type =~ m{^multipart/}) {
return 0;
} elsif ($type =~ m{^(text|message)/}) {
# If textual, we only store externally if it's _large_ (> 10M)
- return 1 if $self->ContentLength > 10 * 1024 * 1024;
+ return 1 if $length > 10 * 1024 * 1024;
return 0;
} elsif ($type =~ m{^image/}) {
# Ditto images, which may be displayed inline
- return 1 if $self->ContentLength > 10 * 1024 * 1024;
+ return 1 if $length > 10 * 1024 * 1024;
return 0;
} else {
return 1;
commit 891667ecac2b12fcb5376bd916dfc71411fff889
Merge: 146aae0 788dfff
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Jan 20 13:00:20 2015 -0500
Merge branch 'empty-content'
commit 246db580f4d1d73b182128f59d1ee0255828a89f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Jan 20 15:13:27 2015 -0500
Version 0.60 releng
diff --git a/Changes b/Changes
index 43d9c94..e2b772b 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+0.60 2015-01-20
+ - Never store 0-length attachments of OCFVs externally
+
0.55 2015-01-05
- Update copyright year
- Add explicit "return 0"s for non-external attachment storage
diff --git a/META.yml b/META.yml
index dbb3c46..ade0155 100644
--- a/META.yml
+++ b/META.yml
@@ -31,6 +31,6 @@ requires:
perl: 5.8.3
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: '0.55'
+version: '0.60'
x_module_install_rtx_version: '0.36'
x_requires_rt: 4.0.22
diff --git a/lib/RT/Extension/ExternalStorage.pm b/lib/RT/Extension/ExternalStorage.pm
index 7e6bc58..dc8e999 100644
--- a/lib/RT/Extension/ExternalStorage.pm
+++ b/lib/RT/Extension/ExternalStorage.pm
@@ -52,7 +52,7 @@ use strict;
package RT::Extension::ExternalStorage;
-our $VERSION = '0.55';
+our $VERSION = '0.60';
use Digest::SHA qw//;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list