From eb92d94788024e8d21dd90001299ae90951f3d34 Mon Sep 17 00:00:00 2001 From: maurycy <5383+maurycy@users.noreply.github.com> Date: Thu, 22 Oct 2020 14:30:59 +0200 Subject: [PATCH 1/3] format UpdatedAt --- core/space/services/services_fs.go | 4 ++-- core/textile/sharing.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/space/services/services_fs.go b/core/space/services/services_fs.go index ea9d547e..3e0784a4 100644 --- a/core/space/services/services_fs.go +++ b/core/space/services/services_fs.go @@ -220,8 +220,8 @@ func (s *Space) listDirAtPath( SizeInBytes: strconv.FormatInt(item.Size, 10), FileExtension: strings.Replace(filepath.Ext(item.Name), ".", "", -1), // FIXME: real created at needed - Created: time.Unix(item.Metadata.UpdatedAt, 0).Format(time.RFC3339), - Updated: time.Unix(item.Metadata.UpdatedAt, 0).Format(time.RFC3339), + Created: time.Unix(0, item.Metadata.UpdatedAt).Format(time.RFC3339), + Updated: time.Unix(0, item.Metadata.UpdatedAt).Format(time.RFC3339), Members: members, }, IpfsHash: item.Cid, diff --git a/core/textile/sharing.go b/core/textile/sharing.go index 2167bfdc..fb5aabb1 100644 --- a/core/textile/sharing.go +++ b/core/textile/sharing.go @@ -219,8 +219,8 @@ func (tc *textileClient) buildPublicLinkSharedDirEntry( Name: file.FileName, SizeInBytes: file.FileSize, FileExtension: strings.Replace(filepath.Ext(file.FileName), ".", "", -1), - Created: strconv.FormatInt(time.Unix(0, file.CreatedAt).Unix(), 10), - Updated: strconv.FormatInt(time.Unix(0, file.CreatedAt).Unix(), 10), + Created: time.Unix(0, file.CreatedAt).Format(time.RFC3339), + Updated: time.Unix(0, file.CreatedAt).Format(time.RFC3339), }, }, Members: []domain.Member{}, @@ -301,8 +301,8 @@ func (tc *textileClient) buildInvitationSharedDirEntry( Name: name, SizeInBytes: strconv.FormatInt(size, 10), FileExtension: ext, - Created: strconv.FormatInt(time.Unix(0, file.CreatedAt).Unix(), 10), - Updated: strconv.FormatInt(time.Unix(updatedAt, 0).Unix(), 10), + Created: time.Unix(0, file.CreatedAt).Format(time.RFC3339), + Updated: time.Unix(0, updatedAt).Format(time.RFC3339), }, }, Members: members, From 3af94a4eb7b6f43ea516be835ed6c3984ab7fd32 Mon Sep 17 00:00:00 2001 From: Perfect Makanju Date: Thu, 22 Oct 2020 14:31:21 +0100 Subject: [PATCH 2/3] Fix: Checks IPFS Download status code for error --- core/ipfs/utils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/ipfs/utils.go b/core/ipfs/utils.go index 482fa4cc..effdd159 100644 --- a/core/ipfs/utils.go +++ b/core/ipfs/utils.go @@ -81,5 +81,9 @@ func DownloadIpfsItem(ctx context.Context, gatewayUrl string, cid cid.Cid) (io.R return nil, err } + if resp.StatusCode != 200 { + return nil, fmt.Errorf("failed to fetch item: status_code %d", resp.StatusCode) + } + return resp.Body, nil } From 84ba0fbee4265a43666a14ad810f9f56ba3b55fe Mon Sep 17 00:00:00 2001 From: Perfect Makanju Date: Thu, 22 Oct 2020 14:55:23 +0100 Subject: [PATCH 3/3] Fix: Prevent null encryptionKey --- core/textile/model/received_file.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/textile/model/received_file.go b/core/textile/model/received_file.go index c7254e93..dc770ea2 100644 --- a/core/textile/model/received_file.go +++ b/core/textile/model/received_file.go @@ -106,6 +106,9 @@ func (m *model) CreateReceivedFileViaPublicLink( FileName: filename, FileSize: fileSize, }, + ReceivedFileViaInvitationSchema: ReceivedFileViaInvitationSchema{ + EncryptionKey: []byte(""), + }, Accepted: accepted, CreatedAt: time.Now().UnixNano(), }