From c4f1ec16c85d01ab6d903cdc5cd132e383786283 Mon Sep 17 00:00:00 2001 From: Yee Hing Tong Date: Thu, 14 Apr 2022 16:53:35 -0700 Subject: [PATCH] Swap base64 for 32 encoding when constructing s3 key (#406) Signed-off-by: Yee Hing Tong --- dataproxy/service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dataproxy/service.go b/dataproxy/service.go index 2ae6441f58..e4932af544 100644 --- a/dataproxy/service.go +++ b/dataproxy/service.go @@ -2,6 +2,7 @@ package dataproxy import ( "context" + "encoding/base32" "encoding/base64" "fmt" "strings" @@ -60,8 +61,10 @@ func (s Service) CreateUploadLocation(ctx context.Context, req *service.CreateUp } md5 := base64.StdEncoding.EncodeToString(req.ContentMd5) + urlSafeMd5 := base32.StdEncoding.EncodeToString(req.ContentMd5) + storagePath, err := createShardedStorageLocation(ctx, s.shardSelector, s.dataStore, s.cfg.Upload, - req.Project, req.Domain, md5, req.Filename) + req.Project, req.Domain, urlSafeMd5, req.Filename) if err != nil { return nil, err }