修复重复编码导致文档转图片预览失败的问题&编码规范

URLEncoder.encode(URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\+", "%20"), uriEncoding);
这里encode了两次,导致图片预览失败。
pull/22/head
范青锋 4 years ago committed by kl
parent 996da0862c
commit b2f6fb3a00

@ -178,14 +178,15 @@ public class FileHandlerService {
String pdfFolder = pdfName.substring(0, pdfName.length() - 4);
String urlPrefix;
try {
urlPrefix = baseUrl + URLEncoder.encode(URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\\+", "%20"), uriEncoding);
urlPrefix = baseUrl + URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\\+", "%20");
} catch (UnsupportedEncodingException e) {
logger.error("UnsupportedEncodingException", e);
urlPrefix = baseUrl + pdfFolder;
}
if (imageCount != null && imageCount > 0) {
for (int i = 0; i < imageCount; i++)
for (int i = 0; i < imageCount; i++) {
imageUrls.add(urlPrefix + "/" + i + imageFileSuffix);
}
return imageUrls;
}
try {

Loading…
Cancel
Save