create slug now private

This commit is contained in:
Djeeberjr 2022-06-01 11:56:15 +02:00
parent 816d63ea49
commit 22946b9dfd

View File

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