Ver a proveniência

Commit the upload

tags/v1.2.0
stefanbenten há 4 anos
ascendente
cometimento
96fb3cbe61
1 ficheiros alterados com 8 adições e 0 eliminações
  1. +8
    -0
      server/storage.go

+ 8
- 0
server/storage.go Ver ficheiro

@@ -630,6 +630,7 @@ func (s *StorjStorage) Get(token string, filename string) (reader io.ReadCloser,
}
contentType = download.Info().Standard.ContentType
contentLength = uint64(download.Info().Standard.ContentLength)
//return the download as a reader
reader = download
return
}
@@ -657,11 +658,18 @@ func (s *StorjStorage) Put(token string, filename string, reader io.Reader, cont
if err != nil {
return err
}

n, err := io.Copy(writer, reader)
if err != nil {
return err
}

err = writer.SetMetadata(ctx, &uplink.StandardMetadata{ContentType: contentType, ContentLength: n}, nil)
if err != nil {
return err
}
//Commit the object!
err = writer.Commit()
return err
}



Carregando…
Cancelar
Guardar