first esitant check is needed

This commit is contained in:
gitGnome
2026-04-15 10:08:20 +02:00
parent fcda29a66b
commit 90018bccdd
2 changed files with 50 additions and 1 deletions
+9 -1
View File
@@ -65,7 +65,7 @@ func MinInit() {
}
func upload(ctx context.Context, key string, body io.Reader, size int64, contentType string, uploader uuid.UUID) error {
func Upload(ctx context.Context, key string, body io.Reader, size int64, contentType string, uploader uuid.UUID) error {
_, err := minClient.PutObject(ctx, globals.FileStorageBucketName, key, body, size,
minio.PutObjectOptions{
ContentType: contentType,
@@ -82,3 +82,11 @@ func getDownloadUrl(ctx context.Context, key string) (*url.URL, error) {
u, err := minClient.PresignedGetObject(ctx, globals.FileStorageBucketName, key, globals.FileDownloadLinkTtl, nil)
return u, err
}
func DoesExist(ctx context.Context, key string) bool {
_, err := minClient.GetObject(ctx, globals.FileStorageBucketName, key, minio.GetObjectOptions{})
if err != nil {
return false
}
return true
}