From 88e1a49dc1fcce808e48c7d8d4b19e95f1b79b2c Mon Sep 17 00:00:00 2001 From: AirboZH Date: Thu, 18 Aug 2022 15:29:01 +0800 Subject: [PATCH] fix: Qiniuoss cannot upload non image attachments --- .../halo/app/handler/file/QiniuOssFileHandler.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/run/halo/app/handler/file/QiniuOssFileHandler.java b/src/main/java/run/halo/app/handler/file/QiniuOssFileHandler.java index 6e890b9c5d..e0e454dc1a 100644 --- a/src/main/java/run/halo/app/handler/file/QiniuOssFileHandler.java +++ b/src/main/java/run/halo/app/handler/file/QiniuOssFileHandler.java @@ -142,14 +142,15 @@ public UploadResult upload(MultipartFile file) { result.setMediaType(MediaType.valueOf(Objects.requireNonNull(file.getContentType()))); result.setSize(file.getSize()); - if (isImageType(file)) { + // Handle thumbnail + handleImageMetadata(file, result, () -> { if (ImageUtils.EXTENSION_ICO.equals(pathDescriptor.getExtension())) { - result.setThumbPath(fullPath); + return fullPath; } else { - result.setThumbPath(StringUtils.isBlank(thumbnailStyleRule) ? fullPath : - fullPath + thumbnailStyleRule); + return StringUtils.isBlank(thumbnailStyleRule) ? fullPath : + fullPath + thumbnailStyleRule; } - } + }); return result; } catch (IOException e) {