♻️ Refactoring code.优化方法稳定性,避免minio存储桶名字中带有-时造成解析异常
This commit is contained in:
1 parent
f6fb9d0c56
commit
58371ad4cf
1 file changed
+2
-3
+2
-3
@@ -82,9 +82,8 @@ public class FileController {
|
||||
*/
|
||||
@GetMapping("/{fileName}")
|
||||
public void file(@PathVariable String fileName, HttpServletResponse response) {
|
||||
String[] nameArray = StrUtil.split(fileName, StrUtil.DASHED);
|
||||
|
||||
try (InputStream inputStream = minioTemplate.getObject(nameArray[0], nameArray[1])) {
|
||||
Integer separator = fileName.lastIndexOf(StrUtil.DASHED);
|
||||
try (InputStream inputStream = minioTemplate.getObject(fileName.substring(0,separator),fileName.substring(separator+1,fileName.length()))) {
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
IoUtil.copy(inputStream, response.getOutputStream());
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in new issue
Block a user