From 199487bdf6e34030b9750aea41446e2d92e30254 Mon Sep 17 00:00:00 2001 From: Marius Date: Sat, 26 Mar 2016 18:23:37 +0100 Subject: [PATCH] Set correct ID in S3Store.GetInfo --- s3store/s3store.go | 5 +++++ s3store/s3store_test.go | 1 + 2 files changed, 6 insertions(+) diff --git a/s3store/s3store.go b/s3store/s3store.go index e4401e7..0980bf4 100644 --- a/s3store/s3store.go +++ b/s3store/s3store.go @@ -278,6 +278,11 @@ func (store S3Store) GetInfo(id string) (info tusd.FileInfo, err error) { return info, err } + // The JSON object stored on S3 does not contain the proper upload ID because + // the ID has constructed after the storing happened. Therefore we set it + // manually. + info.ID = id + // Get uploaded parts and their offset listPtr, err := store.Service.ListParts(&s3.ListPartsInput{ Bucket: aws.String(store.Bucket), diff --git a/s3store/s3store_test.go b/s3store/s3store_test.go index adead7f..c77b13f 100644 --- a/s3store/s3store_test.go +++ b/s3store/s3store_test.go @@ -123,6 +123,7 @@ func TestGetInfo(t *testing.T) { assert.Nil(err) assert.Equal(int64(500), info.Size) assert.Equal(int64(300), info.Offset) + assert.Equal("uploadId+multipartId", info.ID) } func TestGetInfoFinished(t *testing.T) {