From 22946b9dfdf211377285f21445d1dadf2b674363 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Wed, 1 Jun 2022 11:56:15 +0200 Subject: [PATCH] create slug now private --- internal/client/client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/client/client.go b/internal/client/client.go index 4a78afb..5ca4740 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -35,7 +35,7 @@ func createRandomString() string { return string(s) } -func (c *Client) CreateValidSlug(ctx context.Context) (string, error) { +func (c *Client) createValidSlug(ctx context.Context) (string, error) { for i := 0; i < 10; i++ { slug := createRandomString() @@ -57,7 +57,7 @@ func (c *Client) GetShare(ctx context.Context, slug string) (*types.Share, error } func (c *Client) CreateShare(ctx context.Context, key string) (*types.Share, error) { - slug, err := c.CreateValidSlug(ctx) + slug, err := c.createValidSlug(ctx) if err != nil { return nil, err } @@ -98,6 +98,10 @@ func (c *Client) GetObjectMetadata(ctx context.Context, key string) (*types.Meta return nil, err } + if metadata == nil { + return nil, nil + } + if metadata.Filename == "" { metadata.Filename = filepath.Base(key) }