Genbox / SimpleS3

A .NET Core implementation of Amazon's S3 API with focus on simplicity, security and performance
MIT License
44 stars 8 forks source link

GenericS3 client does not prepend scheme for presigned requests. #60

Closed Genbox closed 3 weeks ago

Genbox commented 3 weeks ago

Issue described here: https://github.com/Genbox/SimpleS3/issues/59#issuecomment-2305613103

Genbox commented 3 weeks ago

UseTls is only respected when using EndpointTemplate. GenericS3Config ctors require setting an endpoint (not a template) which overrides the use of EndpointTemplate.

Both Endpoint and EndpointTemplate are strings, which means I can't just create an overload for the ctor in GenericS3Config. I could do it like this:

public GenericS3Config(string keyId, string secretKey, string endpointOrTemplate, bool useEndpointTemplate, string regionCode)

But it is a bit ugly.

Genbox commented 3 weeks ago

I think it would be better to just have Endpoint and then automatically detect if it is a template (contains variables such as {Scheme}).

Genbox commented 3 weeks ago

I've removed EndpointTemplate and now use Endpoint for templates.

There are three template variables:

The variables can be inserted into EndpointTemplate (now Endpoint) like this: {Scheme}://{Bucket:.}s3.{Region:.}amazonaws.com

The :. part means that when the variable has a value, it also appends a .. It can be anything after the colon.

Templates are needed to make UseTls, RegionCode and BucketName on requests work.