first esitant check is needed
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user