From 7ce6b293d53ca79ab5398e6e0681cbe190b15c2e Mon Sep 17 00:00:00 2001 From: jojoliang Date: Fri, 11 Jun 2021 17:58:02 +0800 Subject: [PATCH] add get object url --- object.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/object.go b/object.go index 28a1de5..952f716 100644 --- a/object.go +++ b/object.go @@ -107,6 +107,11 @@ func (s *ObjectService) GetToFile(ctx context.Context, name, localpath string, o return resp, nil } +func (s *ObjectService) GetObjectURL(name string) *url.URL { + uri, _ := url.Parse("/" + encodeURIComponent(name, []byte{'/'})) + return s.client.BaseURL.BucketURL.ResolveReference(uri) +} + type PresignedURLOptions struct { Query *url.Values `xml:"-" url:"-" header:"-"` Header *http.Header `header:"-,omitempty" url:"-" xml:"-"`