feat (patient): remove previously uploaded file when a new one is created

This commit is contained in:
dpurbosakti
2025-09-25 11:14:47 +07:00
parent f618a2d6d0
commit a9e380f957
3 changed files with 44 additions and 0 deletions
+9
View File
@@ -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
}