Fix object download (#466)

If an object is within a folder the object downloaded now only has the object's name.
Also, it now supports object version downloading.
This commit is contained in:
Cesar N
2020-12-03 11:37:53 -06:00
committed by GitHub
parent 726bfe623c
commit d15472f417
9 changed files with 43 additions and 42 deletions

View File

@@ -228,10 +228,14 @@ func getDownloadObjectResponse(session *models.Principal, params user_api.Downlo
return object, nil
}
func downloadObject(ctx context.Context, client MCClient, versionID string) (io.ReadCloser, error) {
func downloadObject(ctx context.Context, client MCClient, versionID *string) (io.ReadCloser, error) {
// TODO: handle encripted files
var reader io.ReadCloser
reader, pErr := client.get(ctx, mc.GetOptions{VersionID: versionID})
var version string
if versionID != nil {
version = *versionID
}
reader, pErr := client.get(ctx, mc.GetOptions{VersionID: version})
if pErr != nil {
return nil, pErr.Cause
}