check if key exists
This commit is contained in:
@@ -66,7 +66,14 @@ func (c *Client) CreateShare(ctx context.Context, key string) (*types.Share, err
|
||||
Key: key,
|
||||
}
|
||||
|
||||
// TODO: check if key exists
|
||||
exists, err := c.s3.KeyExists(ctx, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !exists {
|
||||
return nil, errors.New("key does not exist")
|
||||
}
|
||||
|
||||
err = c.db.CreateShare(ctx, share)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user