[Rt-commit] rt branch, 4.4/externalstorage-backend-key, repushed
Shawn Moore
shawn at bestpractical.com
Wed Jan 25 15:46:35 EST 2017
The branch 4.4/externalstorage-backend-key was deleted and repushed:
was ec09ad3568a86adcd64c571488761ebaed98caf3
now 488e36c5025946ceebbc8f657daa1e590f989dda
1: ec09ad3 ! 1: 488e36c Store backend-specific keys in the attachment
@@ -11,14 +11,16 @@
--- a/lib/RT/ExternalStorage/AmazonS3.pm
+++ b/lib/RT/ExternalStorage/AmazonS3.pm
@@
- my ($sha, $content) = @_;
+ my ($sha, $content, $attachment) = @_;
# No-op if the path exists already
- return (1) if $self->BucketObj->head_key( $sha );
+ return ($sha) if $self->BucketObj->head_key( $sha );
- $self->BucketObj->add_key(
- $sha => $content
+ # Without content_type, S3 can guess wrong and cause attachments downloaded
+ # via a link to have a content type of binary/octet-stream
+@@
+ { content_type => $attachment->ContentType }
) or return (undef, "Failed to write to AmazonS3: " . $self->S3->errstr);
- return (1);
@@ -75,16 +77,16 @@
--- a/sbin/rt-externalize-attachments.in
+++ b/sbin/rt-externalize-attachments.in
@@
- sub Store {
my $content = shift;
+ my $attachment = shift;
- my $key = Digest::SHA::sha256_hex( $content );
-- my ($ok, $msg) = $ExternalStorage->Store( $key => $content );
+- my ($ok, $msg) = $ExternalStorage->Store( $key => $content, $attachment );
- return ($ok, $msg) unless defined $ok;
-
- return ($key);
+ my $sha = Digest::SHA::sha256_hex( $content );
-+ return $ExternalStorage->Store( $sha => $content );
++ return $ExternalStorage->Store( $sha => $content, $attachment );
}
=head1 NAME
More information about the rt-commit
mailing list