mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2025-10-24 17:59:07 +08:00
修复重复编码导致文档转图片预览失败的问题&编码规范
URLEncoder.encode(URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\+", "%20"), uriEncoding);
这里encode了两次,导致图片预览失败。
This commit is contained in:
@@ -178,14 +178,15 @@ public class FileHandlerService {
|
|||||||
String pdfFolder = pdfName.substring(0, pdfName.length() - 4);
|
String pdfFolder = pdfName.substring(0, pdfName.length() - 4);
|
||||||
String urlPrefix;
|
String urlPrefix;
|
||||||
try {
|
try {
|
||||||
urlPrefix = baseUrl + URLEncoder.encode(URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\\+", "%20"), uriEncoding);
|
urlPrefix = baseUrl + URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\\+", "%20");
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
logger.error("UnsupportedEncodingException", e);
|
logger.error("UnsupportedEncodingException", e);
|
||||||
urlPrefix = baseUrl + pdfFolder;
|
urlPrefix = baseUrl + pdfFolder;
|
||||||
}
|
}
|
||||||
if (imageCount != null && imageCount > 0) {
|
if (imageCount != null && imageCount > 0) {
|
||||||
for (int i = 0; i < imageCount; i++)
|
for (int i = 0; i < imageCount; i++) {
|
||||||
imageUrls.add(urlPrefix + "/" + i + imageFileSuffix);
|
imageUrls.add(urlPrefix + "/" + i + imageFileSuffix);
|
||||||
|
}
|
||||||
return imageUrls;
|
return imageUrls;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user