[#2231] revert the aws-sdk-go-v2 change
This commit is contained in:
parent
f5f8c35a17
commit
1420d717e3
|
@ -21,7 +21,7 @@ jobs:
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.20.0'
|
go-version: '>=1.20.3'
|
||||||
|
|
||||||
# This step usually is not needed because the /ui/dist is pregenerated locally
|
# This step usually is not needed because the /ui/dist is pregenerated locally
|
||||||
# but its here to ensure that each release embeds the latest admin ui artifacts.
|
# but its here to ensure that each release embeds the latest admin ui artifacts.
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
- Fixed Admin UI Logs `meta` visualization in Firefox ([#2221](https://github.com/pocketbase/pocketbase/issues/2221)).
|
- Fixed Admin UI Logs `meta` visualization in Firefox ([#2221](https://github.com/pocketbase/pocketbase/issues/2221)).
|
||||||
|
|
||||||
|
- Downgraded to v1 of the `aws/aws-sdk-go` package since v2 has compatibility issues with GCS ([#2231](https://github.com/pocketbase/pocketbase/issues/2231)).
|
||||||
|
|
||||||
|
- Upgraded the GitHub action to use [min Go 1.20.3](https://github.com/golang/go/issues?q=milestone%3AGo1.20.3+label%3ACherryPickApproved) for the prebuilt executable since it contains some minor `net/http` security fixes.
|
||||||
|
|
||||||
|
|
||||||
## v0.14.2
|
## v0.14.2
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,9 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go-v2/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go-v2/config"
|
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||||
"github.com/aws/aws-sdk-go-v2/credentials"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
|
||||||
"github.com/disintegration/imaging"
|
"github.com/disintegration/imaging"
|
||||||
"github.com/gabriel-vasile/mimetype"
|
"github.com/gabriel-vasile/mimetype"
|
||||||
"github.com/pocketbase/pocketbase/tools/list"
|
"github.com/pocketbase/pocketbase/tools/list"
|
||||||
|
@ -44,31 +43,19 @@ func NewS3(
|
||||||
) (*System, error) {
|
) (*System, error) {
|
||||||
ctx := context.Background() // default context
|
ctx := context.Background() // default context
|
||||||
|
|
||||||
cred := credentials.NewStaticCredentialsProvider(accessKey, secretKey, "")
|
cred := credentials.NewStaticCredentials(accessKey, secretKey, "")
|
||||||
|
|
||||||
cfg, err := config.LoadDefaultConfig(ctx,
|
sess, err := session.NewSession(&aws.Config{
|
||||||
config.WithCredentialsProvider(cred),
|
Region: aws.String(region),
|
||||||
config.WithRegion(region),
|
Endpoint: aws.String(endpoint),
|
||||||
config.WithEndpointResolverWithOptions(aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
|
Credentials: cred,
|
||||||
// ensure that the endpoint has url scheme for
|
S3ForcePathStyle: aws.Bool(s3ForcePathStyle),
|
||||||
// backward compatibility with v1 of the aws sdk
|
})
|
||||||
prefixedEndpoint := endpoint
|
|
||||||
if !strings.Contains(endpoint, "://") {
|
|
||||||
prefixedEndpoint = "https://" + endpoint
|
|
||||||
}
|
|
||||||
|
|
||||||
return aws.Endpoint{URL: prefixedEndpoint, SigningRegion: region}, nil
|
|
||||||
})),
|
|
||||||
)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
client := s3.NewFromConfig(cfg, func(o *s3.Options) {
|
bucket, err := s3blob.OpenBucket(ctx, sess, bucketName, nil)
|
||||||
o.UsePathStyle = s3ForcePathStyle
|
|
||||||
})
|
|
||||||
|
|
||||||
bucket, err := s3blob.OpenBucketV2(ctx, client, bucketName, nil)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue