diff --git a/blade-ops/blade-resource/src/main/java/org/springblade/resource/config/OssConfiguration.java b/blade-ops/blade-resource/src/main/java/org/springblade/resource/config/OssConfiguration.java index 65ff40ee..4b31e22a 100644 --- a/blade-ops/blade-resource/src/main/java/org/springblade/resource/config/OssConfiguration.java +++ b/blade-ops/blade-resource/src/main/java/org/springblade/resource/config/OssConfiguration.java @@ -20,6 +20,7 @@ import lombok.AllArgsConstructor; import org.springblade.core.oss.props.OssProperties; import org.springblade.resource.builder.OssBuilder; import org.springblade.resource.mapper.OssMapper; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -30,6 +31,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration @AllArgsConstructor +@EnableConfigurationProperties(OssProperties.class) public class OssConfiguration { private OssProperties ossProperties; diff --git a/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java b/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java index 5dfde9bd..5cac23b2 100644 --- a/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java +++ b/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java @@ -19,6 +19,7 @@ package org.springblade.resource.endpoint; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; import lombok.SneakyThrows; +import org.springblade.core.oss.model.BladeFile; import org.springblade.core.oss.model.OssFile; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; @@ -126,8 +127,8 @@ public class OssEndpoint { @SneakyThrows @PostMapping("/put-file") public R putFile(@RequestParam MultipartFile file) { - ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream()); - return R.data(ossBuilder.template().statFile(file.getOriginalFilename())); + BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream()); + return R.data(ossBuilder.template().statFile(bladeFile.getName())); } /** @@ -140,8 +141,8 @@ public class OssEndpoint { @SneakyThrows @PostMapping("/put-file-by-name") public R putFile(@RequestParam String fileName, @RequestParam MultipartFile file) { - ossBuilder.template().putFile(fileName, file.getInputStream()); - return R.data(ossBuilder.template().statFile(fileName)); + BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream()); + return R.data(ossBuilder.template().statFile(bladeFile.getName())); } /**