mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-12-25 03:40:19 +01:00
Remove Error Wrapping and update Dependencies
This commit is contained in:
parent
ce4e015641
commit
dcaf572f3d
3 changed files with 15 additions and 13 deletions
4
go.mod
4
go.mod
|
@ -26,7 +26,6 @@ require (
|
||||||
github.com/stretchr/testify v1.4.0 // indirect
|
github.com/stretchr/testify v1.4.0 // indirect
|
||||||
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce
|
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce
|
||||||
github.com/urfave/cli v1.22.1
|
github.com/urfave/cli v1.22.1
|
||||||
github.com/zeebo/errs v1.2.2
|
|
||||||
go.opencensus.io v0.22.1 // indirect
|
go.opencensus.io v0.22.1 // indirect
|
||||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc
|
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc
|
||||||
golang.org/x/net v0.0.0-20191007182048-72f939374954
|
golang.org/x/net v0.0.0-20191007182048-72f939374954
|
||||||
|
@ -37,5 +36,6 @@ require (
|
||||||
google.golang.org/genproto v0.0.0-20191007162740-aa923e3a3354 // indirect
|
google.golang.org/genproto v0.0.0-20191007162740-aa923e3a3354 // indirect
|
||||||
google.golang.org/grpc v1.24.0 // indirect
|
google.golang.org/grpc v1.24.0 // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
|
||||||
storj.io/storj v0.26.0
|
storj.io/common v0.0.0-20191227171830-e979646db161
|
||||||
|
storj.io/storj v0.28.3
|
||||||
)
|
)
|
||||||
|
|
5
go.sum
5
go.sum
|
@ -594,7 +594,12 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||||
|
storj.io/common v0.0.0-20191227171830-e979646db161 h1:OR98TPop3UnaFlNdtYYU6ZJyvB5A240kMnD5vtrueKE=
|
||||||
|
storj.io/common v0.0.0-20191227171830-e979646db161/go.mod h1:TYezVM4WnpfGDjaDdSKxmn02ioNVl0NLHIOVwATAq94=
|
||||||
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2 h1:8SgLYEhe99R8QlAD1EAOBPRyIR+cn2hqkXtWlAUPf/c=
|
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2 h1:8SgLYEhe99R8QlAD1EAOBPRyIR+cn2hqkXtWlAUPf/c=
|
||||||
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ=
|
storj.io/drpc v0.0.7-0.20191115031725-2171c57838d2/go.mod h1:/ascUDbzNAv0A3Jj7wUIKFBH2JdJ2uJIBO/b9+2yHgQ=
|
||||||
storj.io/storj v0.26.0 h1:Q2oKu+qch0h0aZb5mOJPC6GaoATaX33Cu7+9kr45+Ws=
|
storj.io/storj v0.26.0 h1:Q2oKu+qch0h0aZb5mOJPC6GaoATaX33Cu7+9kr45+Ws=
|
||||||
storj.io/storj v0.26.0/go.mod h1:dgj21C3P1aD0Xwu6HvSWUOspIj3wvplbpYYRGiRfzAs=
|
storj.io/storj v0.26.0/go.mod h1:dgj21C3P1aD0Xwu6HvSWUOspIj3wvplbpYYRGiRfzAs=
|
||||||
|
storj.io/storj v0.28.2/go.mod h1:EOPjeCQTZQR2ml3dUh0EdU14N1SF+EIA6qwXbQponU4=
|
||||||
|
storj.io/storj v0.28.3 h1:JptRjcprY7MSbXivl6iPT/GX3e9Uw85ahK0/ef/j420=
|
||||||
|
storj.io/storj v0.28.3/go.mod h1:EOPjeCQTZQR2ml3dUh0EdU14N1SF+EIA6qwXbQponU4=
|
||||||
|
|
|
@ -17,15 +17,14 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/s3"
|
"github.com/aws/aws-sdk-go/service/s3"
|
||||||
"github.com/aws/aws-sdk-go/service/s3/s3manager"
|
"github.com/aws/aws-sdk-go/service/s3/s3manager"
|
||||||
"github.com/zeebo/errs"
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"golang.org/x/oauth2/google"
|
"golang.org/x/oauth2/google"
|
||||||
"google.golang.org/api/drive/v3"
|
"google.golang.org/api/drive/v3"
|
||||||
"google.golang.org/api/googleapi"
|
"google.golang.org/api/googleapi"
|
||||||
|
|
||||||
|
"storj.io/common/storj"
|
||||||
"storj.io/storj/lib/uplink"
|
"storj.io/storj/lib/uplink"
|
||||||
"storj.io/storj/pkg/storj"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Storage interface {
|
type Storage interface {
|
||||||
|
@ -566,8 +565,6 @@ func saveGDriveToken(path string, token *oauth2.Token, logger *log.Logger) {
|
||||||
json.NewEncoder(f).Encode(token)
|
json.NewEncoder(f).Encode(token)
|
||||||
}
|
}
|
||||||
|
|
||||||
var uplinkFailure = errs.Class("storj failure")
|
|
||||||
|
|
||||||
type StorjStorage struct {
|
type StorjStorage struct {
|
||||||
Storage
|
Storage
|
||||||
uplink *uplink.Uplink
|
uplink *uplink.Uplink
|
||||||
|
@ -589,22 +586,22 @@ func NewStorjStorage(scope, bucket string, skipCA bool, logger *log.Logger) (*St
|
||||||
|
|
||||||
parsedScope, err := uplink.ParseScope(scope)
|
parsedScope, err := uplink.ParseScope(scope)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, uplinkFailure.Wrap(err)
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.uplink, err = uplink.NewUplink(ctx, &config)
|
instance.uplink, err = uplink.NewUplink(ctx, &config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, uplinkFailure.Wrap(err)
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.project, err = instance.uplink.OpenProject(ctx, parsedScope.SatelliteAddr, parsedScope.APIKey)
|
instance.project, err = instance.uplink.OpenProject(ctx, parsedScope.SatelliteAddr, parsedScope.APIKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, uplinkFailure.Wrap(err)
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.bucket, err = instance.project.OpenBucket(ctx, bucket, parsedScope.EncryptionAccess)
|
instance.bucket, err = instance.project.OpenBucket(ctx, bucket, parsedScope.EncryptionAccess)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, uplinkFailure.Wrap(err)
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.logger = logger
|
instance.logger = logger
|
||||||
|
@ -623,7 +620,7 @@ func (s *StorjStorage) Head(token string, filename string) (contentType string,
|
||||||
|
|
||||||
obj, err := s.bucket.OpenObject(ctx, key)
|
obj, err := s.bucket.OpenObject(ctx, key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", 0, uplinkFailure.Wrap(err)
|
return "", 0, err
|
||||||
}
|
}
|
||||||
contentType = obj.Meta.ContentType
|
contentType = obj.Meta.ContentType
|
||||||
contentLength = uint64(obj.Meta.Size)
|
contentLength = uint64(obj.Meta.Size)
|
||||||
|
@ -640,7 +637,7 @@ func (s *StorjStorage) Get(token string, filename string) (reader io.ReadCloser,
|
||||||
|
|
||||||
obj, err := s.bucket.OpenObject(ctx, key)
|
obj, err := s.bucket.OpenObject(ctx, key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", 0, uplinkFailure.Wrap(err)
|
return nil, "", 0, err
|
||||||
}
|
}
|
||||||
contentType = obj.Meta.ContentType
|
contentType = obj.Meta.ContentType
|
||||||
contentLength = uint64(obj.Meta.Size)
|
contentLength = uint64(obj.Meta.Size)
|
||||||
|
@ -669,7 +666,7 @@ func (s *StorjStorage) Put(token string, filename string, reader io.Reader, cont
|
||||||
|
|
||||||
err = s.bucket.UploadObject(ctx, key, reader, &uplink.UploadOptions{ContentType: contentType})
|
err = s.bucket.UploadObject(ctx, key, reader, &uplink.UploadOptions{ContentType: contentType})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return uplinkFailure.Wrap(err)
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue