From 79c5130066ca51b1dedc1e611721148130638131 Mon Sep 17 00:00:00 2001 From: stefanbenten Date: Thu, 29 Aug 2019 16:35:24 +0200 Subject: [PATCH] Changes according to CR --- server/storage.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/server/storage.go b/server/storage.go index 6a80399..fbc9749 100644 --- a/server/storage.go +++ b/server/storage.go @@ -613,7 +613,7 @@ func (s *StorjStorage) Type() string { } func (s *StorjStorage) Head(token string, filename string) (contentType string, contentLength uint64, err error) { - key := fmt.Sprintf("%s/%s", token, filename) + key := storj.JoinPaths(token, filename) ctx := context.TODO() @@ -628,7 +628,7 @@ func (s *StorjStorage) Head(token string, filename string) (contentType string, } func (s *StorjStorage) Get(token string, filename string) (reader io.ReadCloser, contentType string, contentLength uint64, err error) { - key := fmt.Sprintf("%s/%s", token, filename) + key := storj.JoinPaths(token, filename) ctx := context.TODO() obj, err := s.bucket.OpenObject(ctx, key) @@ -642,7 +642,7 @@ func (s *StorjStorage) Get(token string, filename string) (reader io.ReadCloser, } func (s *StorjStorage) Delete(token string, filename string) (err error) { - key := fmt.Sprintf("%s/%s", token, filename) + key := storj.JoinPaths(token, filename) ctx := context.TODO() @@ -652,7 +652,7 @@ func (s *StorjStorage) Delete(token string, filename string) (err error) { } func (s *StorjStorage) Put(token string, filename string, reader io.Reader, contentType string, contentLength uint64) (err error) { - key := fmt.Sprintf("%s/%s", token, filename) + key := storj.JoinPaths(token, filename) s.logger.Printf("Uploading file %s to S3 Bucket", filename) @@ -664,9 +664,3 @@ func (s *StorjStorage) Put(token string, filename string, reader io.Reader, cont } return nil } - -func toStorjKey(key string) (newKey storj.Key) { - var encryptionKey storj.Key - copy(encryptionKey[:], []byte(key)) - return encryptionKey -}