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) }