|
|
@@ -1,7 +1,7 @@
|
|
|
// Code scaffolded by goctl. Safe to edit.
|
|
|
// goctl 1.10.1
|
|
|
|
|
|
-package auth
|
|
|
+package minio
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
@@ -18,7 +18,7 @@ import (
|
|
|
"perms-system-server/internal/response"
|
|
|
"perms-system-server/internal/svc"
|
|
|
|
|
|
- "github.com/minio/minio-go/v7"
|
|
|
+ miniogo "github.com/minio/minio-go/v7"
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
)
|
|
|
|
|
|
@@ -83,7 +83,7 @@ func (l *MinioUploadLogic) MinioUpload(fileHeader *multipart.FileHeader, file mu
|
|
|
}
|
|
|
objectPath := fmt.Sprintf("%s%s%s", dir, fileMd5, fileExt)
|
|
|
|
|
|
- stat, statErr := l.svcCtx.MinioClient.StatObject(l.ctx, minioFileType.Bucket, objectPath, minio.StatObjectOptions{})
|
|
|
+ stat, statErr := l.svcCtx.MinioClient.StatObject(l.ctx, minioFileType.Bucket, objectPath, miniogo.StatObjectOptions{})
|
|
|
if statErr == nil {
|
|
|
objectFullPath := fmt.Sprintf("%s/%s", minioFileType.Bucket, objectPath)
|
|
|
return &MinioUploadResult{
|
|
|
@@ -94,9 +94,9 @@ func (l *MinioUploadLogic) MinioUpload(fileHeader *multipart.FileHeader, file mu
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
- errCode := minio.ToErrorResponse(statErr).Code
|
|
|
+ errCode := miniogo.ToErrorResponse(statErr).Code
|
|
|
if errCode == "AccessDenied" || errCode == "NoSuchKey" {
|
|
|
- info, err := l.svcCtx.MinioClient.PutObject(l.ctx, minioFileType.Bucket, objectPath, file, fileHeader.Size, minio.PutObjectOptions{
|
|
|
+ info, err := l.svcCtx.MinioClient.PutObject(l.ctx, minioFileType.Bucket, objectPath, file, fileHeader.Size, miniogo.PutObjectOptions{
|
|
|
ContentType: contentType,
|
|
|
})
|
|
|
if err != nil {
|
|
|
@@ -121,7 +121,7 @@ func (l *MinioUploadLogic) ensureBucketExists(bucket string) error {
|
|
|
return err
|
|
|
}
|
|
|
if !exists {
|
|
|
- return l.svcCtx.MinioClient.MakeBucket(l.ctx, bucket, minio.MakeBucketOptions{})
|
|
|
+ return l.svcCtx.MinioClient.MakeBucket(l.ctx, bucket, miniogo.MakeBucketOptions{})
|
|
|
}
|
|
|
return nil
|
|
|
}
|