create slug now private
This commit is contained in:
parent
816d63ea49
commit
22946b9dfd
@ -35,7 +35,7 @@ func createRandomString() string {
|
|||||||
return string(s)
|
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++ {
|
for i := 0; i < 10; i++ {
|
||||||
slug := createRandomString()
|
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) {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -98,6 +98,10 @@ func (c *Client) GetObjectMetadata(ctx context.Context, key string) (*types.Meta
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if metadata == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
if metadata.Filename == "" {
|
if metadata.Filename == "" {
|
||||||
metadata.Filename = filepath.Base(key)
|
metadata.Filename = filepath.Base(key)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user