aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/asset/backend_gcs.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2022-09-29 09:26:29 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2022-09-29 12:55:00 +0200
commitd9da3ac6347057f9742c199502651572f46f9bf0 (patch)
tree1e46c6048b0e4b89cb03c3b15ff6da754acddcdb /pkg/asset/backend_gcs.go
parent1d385642c6e7ff09f8689d6e0d70b07cc40af05d (diff)
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().
Diffstat (limited to 'pkg/asset/backend_gcs.go')
-rw-r--r--pkg/asset/backend_gcs.go4
1 files changed, 2 insertions, 2 deletions
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) {