From d9da3ac6347057f9742c199502651572f46f9bf0 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 29 Sep 2022 09:26:29 +0000 Subject: pkg/asset: fix download URLs formation for duplicate assets From the upload method, always return the path without the bucket. Always prepend the bucket name in the downloadURL(). --- pkg/asset/backend_gcs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/asset/backend_gcs.go b/pkg/asset/backend_gcs.go index 6690ee3e9..0a14781fc 100644 --- a/pkg/asset/backend_gcs.go +++ b/pkg/asset/backend_gcs.go @@ -77,12 +77,12 @@ func (csb *cloudStorageBackend) upload(req *uploadRequest) (*uploadResponse, err writeCloser: w, tracer: csb.tracer, }, - path: path, + path: req.savePath, }, nil } func (csb *cloudStorageBackend) downloadURL(path string, publicURL bool) (string, error) { - return csb.client.GetDownloadURL(path, publicURL), nil + return csb.client.GetDownloadURL(fmt.Sprintf("%s/%s", csb.bucket, path), publicURL), nil } func (csb *cloudStorageBackend) getPath(downloadURL string) (string, error) { -- cgit mrf-deployment