Browse Source

Update to RC

tags/v1.2.0
stefanbenten 4 years ago
parent
commit
38996c9c7f
3 changed files with 15 additions and 14 deletions
  1. +2
    -2
      go.mod
  2. +4
    -5
      go.sum
  3. +9
    -7
      server/storage.go

+ 2
- 2
go.mod View File

@@ -36,6 +36,6 @@ require (
google.golang.org/genproto v0.0.0-20191007162740-aa923e3a3354 // indirect
google.golang.org/grpc v1.24.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
storj.io/common v0.0.0-20200214070817-cfd197b055d7
storj.io/uplink v0.0.0-20200221171743-26268cdd3552
storj.io/common v0.0.0-20200226144507-3fe9f7839df5
storj.io/uplink v1.0.0-rc.2
)

+ 4
- 5
go.sum View File

@@ -149,7 +149,6 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975 h1:/Tl7pH94bvbAAHBdZJT947M/+gp0+CqQXDtMRC0fseo=
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -277,9 +276,9 @@ 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.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
storj.io/common v0.0.0-20200214070817-cfd197b055d7 h1:/ZBREex7JB8JC00R7O8RO17nIAKk6b/sJ+i7/66PzGU=
storj.io/common v0.0.0-20200214070817-cfd197b055d7/go.mod h1:MlYmhIuKHfD15puGH7Su5lv0bt4ojZ7IfrPnAmR4NeI=
storj.io/common v0.0.0-20200226144507-3fe9f7839df5 h1:PbXUP30pEdk+HiRPwLfBD9wA+CY1Eu788BwJPecpFBM=
storj.io/common v0.0.0-20200226144507-3fe9f7839df5/go.mod h1:lCc2baFO7GQlKsPTri8xwCsCPO2LsEUUiAGeRQuXY48=
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/uplink v0.0.0-20200221171743-26268cdd3552 h1:yXojx6mQXtJfwh5qdUEakWvh+EXkJbTV4qWE1aPJzTU=
storj.io/uplink v0.0.0-20200221171743-26268cdd3552/go.mod h1:SAetpjpLjDx0bH/TgfMaD2O/S283bn/Kcz8f/juI03I=
storj.io/uplink v1.0.0-rc.2 h1:IykgqbqwXDRJAaDXO0+t1CCfntetRvdWK9mUQsWtz/8=
storj.io/uplink v1.0.0-rc.2/go.mod h1:WUQYQZFI7iUxqarO1zhUwlVgiHxv4PGZlsQFh8XE8yg=

+ 9
- 7
server/storage.go View File

@@ -613,8 +613,10 @@ func (s *StorjStorage) Head(token string, filename string) (contentType string,
if err != nil {
return "", 0, err
}
contentType = obj.Standard.ContentType
contentLength = uint64(obj.Standard.ContentLength)

customMeta := obj.Custom.Clone()
contentType = customMeta["contentType"]
contentLength = uint64(obj.System.ContentLength)

return
}
@@ -631,8 +633,9 @@ func (s *StorjStorage) Get(token string, filename string) (reader io.ReadCloser,
return nil, "", 0, err
}

contentType = download.Info().Standard.ContentType
contentLength = uint64(download.Info().Standard.ContentLength)
customMeta := download.Info().Custom.Clone()
contentType = customMeta["contentType"]
contentLength = uint64(download.Info().System.ContentLength)

reader = download
return
@@ -662,14 +665,13 @@ func (s *StorjStorage) Put(token string, filename string, reader io.Reader, cont
return err
}

n, err := io.Copy(writer, reader)
_, err = io.Copy(writer, reader)
if err != nil {
//Ignoring the error to return the one that occurred first, but try to clean up.
_ = writer.Abort()
return err
}

err = writer.SetMetadata(ctx, &uplink.StandardMetadata{ContentType: contentType, ContentLength: n}, nil)
err = writer.SetCustomMetadata(ctx, uplink.CustomMetadata{"ContentType": contentType})
if err != nil {
//Ignoring the error to return the one that occurred first, but try to clean up.
_ = writer.Abort()


Loading…
Cancel
Save