From d9bbc49b37a0d5a83b5d740b5d7e8909de08bd9f Mon Sep 17 00:00:00 2001 From: ronger Date: Fri, 14 Jan 2022 12:14:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:bug:=20=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E8=AE=B0=E5=BD=95=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=20ID=20=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/rymcu/forest/web/api/common/UploadController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/rymcu/forest/web/api/common/UploadController.java b/src/main/java/com/rymcu/forest/web/api/common/UploadController.java index 437ff25..0f7ee23 100644 --- a/src/main/java/com/rymcu/forest/web/api/common/UploadController.java +++ b/src/main/java/com/rymcu/forest/web/api/common/UploadController.java @@ -213,7 +213,7 @@ public class UploadController { } private TokenUser getTokenUser(HttpServletRequest request) throws BaseApiException { - String authHeader = request.getHeader(JwtConstants.AUTHORIZATION); + String authHeader = request.getHeader(JwtConstants.UPLOAD_TOKEN); if (StringUtils.isBlank(authHeader)) { throw new BaseApiException(ErrorCode.UNAUTHORIZED); } From 53a6313fdc0ddfd884b99c5bd3db9afc165601e4 Mon Sep 17 00:00:00 2001 From: ronger Date: Fri, 14 Jan 2022 13:47:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:bug:=20=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/rymcu/forest/web/api/common/UploadController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rymcu/forest/web/api/common/UploadController.java b/src/main/java/com/rymcu/forest/web/api/common/UploadController.java index 0f7ee23..98a21cd 100644 --- a/src/main/java/com/rymcu/forest/web/api/common/UploadController.java +++ b/src/main/java/com/rymcu/forest/web/api/common/UploadController.java @@ -189,7 +189,7 @@ public class UploadController { String fileName = System.currentTimeMillis() + fileType; String savePath = file.getPath() + File.separator + fileName; File saveFile = new File(savePath); - try (InputStream in = multipartFiles[i].getInputStream(); OutputStream out = Files.newOutputStream(saveFile.toPath())) { + try (InputStream in = multipartFile.getInputStream()) { String md5 = DigestUtils.md5DigestAsHex(in); String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType); if (StringUtils.isNotEmpty(fileUrl)) { @@ -197,7 +197,7 @@ public class UploadController { continue; } fileUrl = localPath + fileName; - FileCopyUtils.copy(in, out); + FileCopyUtils.copy(multipartFile.getBytes(), saveFile); forestFileService.insertForestFile(fileUrl, savePath, md5, tokenUser.getIdUser(), multipartFile.getSize(), fileType); successMap.put(orgName, localPath + fileName); } catch (IOException e) {