From c2e2baa3165810c38c05dc32167f8a8e9b0d271b Mon Sep 17 00:00:00 2001 From: T2cc <5152438+gtguizhou@user.noreply.gitee.com> Date: Mon, 28 Jun 2021 06:06:21 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E5=B0=BE=E9=83=A8=E5=A6=82=E6=9E=9C=E5=8C=85=E5=90=AB=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E7=AC=A6=E5=90=88=E4=BC=9A=E5=AF=BC=E8=87=B4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=BD=AC=E6=8D=A2=E5=87=BA=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/keking/service/FileHandlerService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/cn/keking/service/FileHandlerService.java b/server/src/main/java/cn/keking/service/FileHandlerService.java index d8ba3122..c5122969 100644 --- a/server/src/main/java/cn/keking/service/FileHandlerService.java +++ b/server/src/main/java/cn/keking/service/FileHandlerService.java @@ -175,7 +175,7 @@ public class FileHandlerService { List imageUrls = new ArrayList<>(); Integer imageCount = this.getConvertedPdfImage(pdfFilePath); String imageFileSuffix = ".jpg"; - String pdfFolder = pdfName.substring(0, pdfName.length() - 4); + String pdfFolder = pdfName.substring(0, pdfName.length() - 4).trim(); String urlPrefix; try { urlPrefix = baseUrl + URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\\+", "%20"); @@ -196,7 +196,7 @@ public class FileHandlerService { PDFRenderer pdfRenderer = new PDFRenderer(doc); int index = pdfFilePath.lastIndexOf("."); - String folder = pdfFilePath.substring(0, index); + String folder = pdfFilePath.substring(0, index).trim(); File path = new File(folder); if (!path.exists() && !path.mkdirs()) { -- Gitee