-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Open
Description
if (isCompressFile) { //判断是否使用特定压缩包符号
try {
originFileName = URLDecoder.decode(compressFilePath, uriEncoding); //转义的文件名 解下出原始文件名
attribute.setSkipDownLoad(true);
} catch (UnsupportedEncodingException e) {
logger.error("Failed to decode file name: {}", originFileName, e);
}
}
/**
* 获取本地 pdf 转 image 后的 web 访问地址
*
* @param pdfFilePath pdf文件名
* @param index 图片索引
* @return 图片访问地址
*/
private String getPdf2jpgUrl(String pdfFilePath, int index) {
String baseUrl = BaseUrlFilter.getBaseUrl();
pdfFilePath = pdfFilePath.replace(fileDir, "");
String pdfFolder = pdfFilePath.substring(0, pdfFilePath.length() - 4).replace("\", "/");
String urlPrefix;
try {
String encodedPath = URLEncoder.encode(pdfFolder, uriEncoding);
encodedPath = encodedPath.replaceAll("%2F", "/")
.replaceAll("\+", "%20");
urlPrefix = baseUrl + encodedPath;
} catch (UnsupportedEncodingException e) {
logger.error("UnsupportedEncodingException", e);
urlPrefix = baseUrl + pdfFolder;
}
return urlPrefix + "/" + index + PDF2JPG_IMAGE_FORMAT;
}
Metadata
Metadata
Assignees
Labels
No labels