#2 Backport patch to make mutlipart uploads work
Closed a year ago by ppisar. Opened a year ago by ignatenkobrain.
rpms/ ignatenkobrain/perl-Net-Amazon-S3 rawhide  into  rawhide

@@ -0,0 +1,64 @@ 

+ From 08bdad1864695c7c98b84f1fed6adfa07fb8da72 Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?V=C3=ADt=20Str=C3=A1dal?= <vit.stradal@gooddata.com>

+ Date: Wed, 22 Mar 2023 10:03:58 +0100

+ Subject: [PATCH] Fix `initiate_multipart_upload()` content type check

+ 

+ ---

+  lib/Net/Amazon/S3/Client/Object.pm  | 2 --

+  lib/Net/Amazon/S3/Response.pm       | 7 ++++++-

+  t/s3-operation-object-upload-part.t | 4 ----

+  3 files changed, 6 insertions(+), 7 deletions(-)

+ 

+ diff --git a/lib/Net/Amazon/S3/Client/Object.pm b/lib/Net/Amazon/S3/Client/Object.pm

+ index 22686237..1f879000 100644

+ --- a/lib/Net/Amazon/S3/Client/Object.pm

+ +++ b/lib/Net/Amazon/S3/Client/Object.pm

+ @@ -344,8 +344,6 @@ sub put_part {

+  

+  		upload_id   => $args{upload_id},

+  		part_number => $args{part_number},

+ -		acl_short   => $args{acl_short},

+ -		copy_source => $args{copy_source},

+  		headers     => $args{headers},

+  		value       => $args{value},

+  	);

+ diff --git a/lib/Net/Amazon/S3/Response.pm b/lib/Net/Amazon/S3/Response.pm

+ index 84facb5c..89712524 100644

+ --- a/lib/Net/Amazon/S3/Response.pm

+ +++ b/lib/Net/Amazon/S3/Response.pm

+ @@ -122,7 +122,12 @@ sub version_id {

+  sub is_xml_content {

+  	my ($self) = @_;

+  

+ -	return $self->content_type =~ m:[/+]xml\b: && $self->decoded_content;

+ +	my $decoded_content = $self->decoded_content;

+ +	my $content_type = $self->content_type;

+ +

+ +	return $content_type =~ m{[/+]xml\b} && $decoded_content if $content_type;

+ +	return 1 if $decoded_content && $decoded_content =~ /^<\?xml\b/;

+ +	return 0;

+  }

+  

+  sub is_error {

+ diff --git a/t/s3-operation-object-upload-part.t b/t/s3-operation-object-upload-part.t

+ index add5647e..6ede1c8e 100644

+ --- a/t/s3-operation-object-upload-part.t

+ +++ b/t/s3-operation-object-upload-part.t

+ @@ -42,8 +42,6 @@ sub expect_operation_object_upload_part {

+  					value       => 'foo-bar-baz',

+  					upload_id   => 42,

+  					part_number => 1,

+ -					acl_short   => 'private',

+ -					copy_source => 'source-key',

+  					headers     => {

+  						x_amz_meta_additional => 'additional-header',

+  					},

+ @@ -54,8 +52,6 @@ sub expect_operation_object_upload_part {

+  					value       => 'foo-bar-baz',

+  					upload_id   => 42,

+  					part_number => 1,

+ -					acl_short   => 'private',

+ -					copy_source => 'source-key',

+  					headers     => {

+  						x_amz_meta_additional => 'additional-header',

+  						'Content-Length' => 11,

file modified
+6 -3
@@ -1,6 +1,6 @@ 

  Name:       perl-Net-Amazon-S3

  Version:    0.991

- Release:    3%{?dist}

+ Release:    4%{?dist}

  Summary:    Use the Amazon Simple Storage Service (S3)

  # README.md reports the code is derived from an ADSL-licensed code.

  License:    (GPL-1.0-or-later OR Artistic-1.0-Perl) AND ADSL
@@ -8,6 +8,7 @@ 

  Source0:    https://cpan.metacpan.org/authors/id/B/BA/BARNEY/Net-Amazon-S3-%{version}.tar.gz

  # Fix shebang

  Patch0:     Net-Amazon-S3-0.86-Normalize-shellbang.patch

+ Patch1:     https://github.com/rustyconover/net-amazon-s3/commit/08bdad1864695c7c98b84f1fed6adfa07fb8da72.patch#/0001-Fix-initiate_multipart_upload-content-type-check.patch

  BuildArch:  noarch

  BuildRequires:  coreutils

  BuildRequires:  findutils
@@ -131,8 +132,7 @@ 

  with "%{_libexecdir}/%{name}/test".

  

  %prep

- %setup -q -n Net-Amazon-S3-%{version}

- %patch0 -p1

+ %autosetup -n Net-Amazon-S3-%{version} -p1

  # Get rid of unnecessary executable bits

  find lib -name '*.pm' -exec chmod -c -x {} +

  # Remove author tests
@@ -193,6 +193,9 @@ 

  %{_libexecdir}/%{name}

  

  %changelog

+ * Wed Mar 22 2023 Igor Raits <igot@gooddata.com> - 0.991-4

+ - Backport patch to make mutlipart uploads work

+ 

  * Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.991-3

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

  

no initial comment

Would appreciate if you could backport this to epel8/epel9 builds. Thank you!

Thanks for the patch. I slightly reworded the changes in spec file and applied to Fedora 39–36 and and EPEL 9.

I looked at EPEL 7 and there is Net-Amazon-S3-0.89 which is much different from 0.911: It has put_part() method which probably carries the two default arguments acl_short and copy_source using same-named roles of Net::Amazon::S3::Request::PutPart class. Those roles could be removed from the class. Regarding the is_xml_content(), the only similar check for XML content type is in _send_request().

Because I don't know anything about S3 and I don't have any account at Amazon to test it, I don't feel qualified to backport the patch to Net-Amazon-S3-0.89 in EPEL87 So I'm going to skip EPEL7. If you provide a tested patch, I'll be happy to apply it.

EPEL 7 was not updated to the latest Net-Amazon-S3 because 0.90 removed a documentation and 0.92 brought significant changes. There were also problems with tests which already in 0.89 required changes to work with other EPEL-7 packages. So unless somebody indicates that 0.89 does not work at all with current S3 servers, I'm hesitant to rebase it to the latest upstream version.

Pull-Request has been closed by ppisar

a year ago

Thank you! The EPEL7 is not something I care about :)