refactor: 优化部分代码
修复 Sonar 扫描问题
This commit is contained in:
parent
bcdcf888fb
commit
d5716d661f
@ -118,8 +118,7 @@ public class StorageServiceImpl extends BaseServiceImpl<StorageMapper, StorageDO
|
||||
String bucketName = req.getBucketName();
|
||||
String domain = req.getDomain();
|
||||
StorageTypeEnum type = req.getType();
|
||||
switch (type) {
|
||||
case LOCAL -> {
|
||||
if (StorageTypeEnum.LOCAL.equals(type)) {
|
||||
ValidationUtils.throwIfBlank(bucketName, "存储路径不能为空");
|
||||
ValidationUtils.throwIfBlank(domain, "自定义域名不能为空");
|
||||
ValidationUtils.throwIf(!URLUtils.isHttpUrl(domain), "自定义域名格式错误");
|
||||
@ -131,8 +130,7 @@ public class StorageServiceImpl extends BaseServiceImpl<StorageMapper, StorageDO
|
||||
fileStorageList.addAll(FileStorageServiceBuilder.buildLocalPlusFileStorage(Collections
|
||||
.singletonList(config)));
|
||||
SpringWebUtils.registerResourceHandler(MapUtil.of(URLUtil.url(req.getDomain()).getPath(), bucketName));
|
||||
}
|
||||
case S3 -> {
|
||||
} else if (StorageTypeEnum.S3.equals(type)) {
|
||||
String accessKey = req.getAccessKey();
|
||||
String secretKey = req.getSecretKey();
|
||||
String endpoint = req.getEndpoint();
|
||||
@ -151,7 +149,6 @@ public class StorageServiceImpl extends BaseServiceImpl<StorageMapper, StorageDO
|
||||
.singletonList(config), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload(StorageReq req) {
|
||||
|
Loading…
Reference in New Issue
Block a user