Skip to content

Conversation

mdupras
Copy link
Contributor

@mdupras mdupras commented Jun 4, 2025

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Updated the AWSSDK.S3 to 4.0 release and fix the compilation issue.
Now metadata.LastModified can be null, I don't think it's like to happen in this scenario, but if it does the default Date is Now to assume the Image needs to be refreshed.

@dlemstra
Copy link
Member

dlemstra commented Jun 4, 2025

The 3.x range is also still being updated but I think we can upgrade to the 4.x range because we don't need net3.5 support

@JimBobSquarePants
Copy link
Member

@dlemstra I'm not convinced we can update yet.

By doing so we introduce a breaking change via the dependency. Normally that would require a major version on our part.

@mdupras we have multiple failing tests here. Could you please have a look?

@@ -9,6 +9,8 @@ namespace SixLabors.ImageSharp.Web;

internal static class AmazonS3ClientFactory
{
static AmazonS3ClientFactory() => AWSConfigs.InitializeCollections = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Altering global behavior for transitive dependency does not appear be a prudent. It would be more appropriate to update the code to accommodate changes in behavior.

@mdupras
Copy link
Contributor Author

mdupras commented Jun 11, 2025

@dlemstra I'm not convinced we can update yet.

By doing so we introduce a breaking change via the dependency. Normally that would require a major version on our part.

@mdupras we have multiple failing tests here. Could you please have a look?

Thanks, I'm looking into it a bit. Managed to get the test failing locally, I'll try to take some time to investigate that soon!

@JimBobSquarePants
Copy link
Member

JimBobSquarePants commented Jul 31, 2025

@dlemstra I'm not convinced we can update yet.
By doing so we introduce a breaking change via the dependency. Normally that would require a major version on our part.
@mdupras we have multiple failing tests here. Could you please have a look?

Thanks, I'm looking into it a bit. Managed to get the test failing locally, I'll try to take some time to investigate that soon!

I had a look myself and there's something odd going on. The test is failing as there seems to be an additional 43 bytes of data attached (I'm assuming at the beginning of the stream) when we retrieve the file from the cache. I don't know yet whether this is an issue with the s3rver library or something in the SDK itself. I'm pulling down the SDK source now.

@JimBobSquarePants
Copy link
Member

JimBobSquarePants commented Jul 31, 2025

@mdupras to follow up I discovered that there was a behavioral change in AWS. It's inserting a byte sequence before our output.

51 = '3'
50 = '2'
67 = 'C'
13 = '\r'
10 = '\n'

32C\r\n is 812 followed by line breaks which is the correct length of the blob.

I added the following locally and everything works!! however I cannot get it to work in the CI on any OS.

PutObjectRequest request = new()
{
    BucketName = this.bucketName,
    Key = this.GetKeyWithFolder(key),
    ContentType = metadata.ContentType,
    InputStream = stream,
    AutoCloseStream = false,
    UseChunkEncoding = false // THIS WAS DEFAULTING TO TRUE
};

I've opened PR #392 to replace this one as I updated Azure also

@mdupras
Copy link
Contributor Author

mdupras commented Jul 31, 2025

Thanks @JimBobSquarePants !
I didn't have much time to put on this, but it never crossed my mind that somehow the new version now adds new bytes at the end.

The other annoying thing with the new version is if a static variable isn't changed, all the collections types in responses will be null instead of empty. Great way of sending nullref everywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants