We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileHandlerService的getPdf2jpgUrl方法存在多余的转义,导致压缩包中的word文件无法正常预览。 压缩包中的word文件,在此处的pdfFolder将携带/路径,URLEncoder.encode后会将/转义,导致无法正确定向word解析生成的图片资源路径。
FileHandlerService
getPdf2jpgUrl
pdfFolder
URLEncoder.encode
/** * 获取本地 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); String urlPrefix; try { urlPrefix = baseUrl + URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { logger.error("UnsupportedEncodingException", e); urlPrefix = baseUrl + pdfFolder; } return urlPrefix + "/" + index + PDF2JPG_IMAGE_FORMAT; }
涉及版本为master分支最新代码: 3482ee5
此处无需使用URLEncoder.encode转义,中文路径也可正常访问。建议修改如下:
/** * 获取本地 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); String urlPrefix = baseUrl + pdfFolder; return urlPrefix + "/" + index + PDF2JPG_IMAGE_FORMAT; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
FileHandlerService
的getPdf2jpgUrl
方法存在多余的转义,导致压缩包中的word文件无法正常预览。压缩包中的word文件,在此处的
pdfFolder
将携带/路径,URLEncoder.encode
后会将/转义,导致无法正确定向word解析生成的图片资源路径。The text was updated successfully, but these errors were encountered: