From f27665b00beebf3894e5bd2685e19de86767813f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=B2=90?= Date: Wed, 6 Dec 2023 10:35:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=83=E7=89=9B=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0=EF=BC=8C=E8=8E=B7=E5=8F=96token?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/net/maku/storage/service/QiniuStorageService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/maku-boot-system/src/main/java/net/maku/storage/service/QiniuStorageService.java b/maku-boot-system/src/main/java/net/maku/storage/service/QiniuStorageService.java index 238c964..9d84b85 100644 --- a/maku-boot-system/src/main/java/net/maku/storage/service/QiniuStorageService.java +++ b/maku-boot-system/src/main/java/net/maku/storage/service/QiniuStorageService.java @@ -20,19 +20,20 @@ import java.io.InputStream; */ public class QiniuStorageService extends StorageService { private final UploadManager uploadManager; - private final String token; public QiniuStorageService(StorageProperties properties) { this.properties = properties; uploadManager = new UploadManager(new Configuration(Region.autoRegion())); - token = Auth.create(properties.getQiniu().getAccessKey(), properties.getQiniu().getSecretKey()). - uploadToken(properties.getQiniu().getBucketName()); + } @Override public String upload(byte[] data, String path) { try { + String token = Auth.create(properties.getQiniu().getAccessKey(), properties.getQiniu().getSecretKey()). + uploadToken(properties.getQiniu().getBucketName()); + Response res = uploadManager.put(data, path, token); if (!res.isOK()) { throw new ServerException(res.toString());