pull/232/head
wangchuxiao 3 years ago
parent 4ea8cb5903
commit 928fc374c7

@ -83,7 +83,7 @@ func MinioUploadFile(c *gin.Context) {
return return
} }
newName, newType := utils.GetNewFileNameAndContentType(file.Filename, req.FileType) newName, newType := utils.GetNewFileNameAndContentType(file.Filename, req.FileType)
log.Debug(req.OperationID, utils.GetSelfFuncName(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, newType) log.Debug(req.OperationID, utils.GetSelfFuncName(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, newType, MinioClient.EndpointURL())
_, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, minio.PutObjectOptions{ContentType: newType}) _, err = MinioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, minio.PutObjectOptions{ContentType: newType})
if err != nil { if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "upload file error") log.NewError(req.OperationID, utils.GetSelfFuncName(), "upload file error")

@ -112,7 +112,7 @@ func UploadUpdateApp(c *gin.Context) {
Creds: credentials.NewStaticV4(config.Config.Credential.Minio.AccessKeyID, config.Config.Credential.Minio.SecretAccessKey, ""), Creds: credentials.NewStaticV4(config.Config.Credential.Minio.AccessKeyID, config.Config.Credential.Minio.SecretAccessKey, ""),
Secure: false, Secure: false,
}) })
fmt.Println(apiThird.MinioClient.EndpointURL()) fmt.Println(minioClient.EndpointURL())
_, err = minioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, newFileName, fileObj, file.Size, minio.PutObjectOptions{ContentType: path.Ext(newFileName)}) _, err = minioClient.PutObject(context.Background(), config.Config.Credential.Minio.AppBucket, newFileName, fileObj, file.Size, minio.PutObjectOptions{ContentType: path.Ext(newFileName)})
if err != nil { if err != nil {

Loading…
Cancel
Save