feat (patient): remove previously uploaded file when a new one is created
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"path"
|
||||
|
||||
m "simrs-vx/internal/infra/minio"
|
||||
|
||||
@@ -165,3 +166,11 @@ func GetEndpointUrl(bucket string) string {
|
||||
}
|
||||
return fmt.Sprintf("%s://%s/%s", mode, m.O.GetEndpoint(), bucket)
|
||||
}
|
||||
|
||||
func GetFilename(rawUrl string) (string, error) {
|
||||
parsed, err := url.Parse(rawUrl)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return path.Base(parsed.Path), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user