Skip to content

最新版本压缩包不能使用和URL编码处理 #700

@LIXianSenQwQ

Description

@LIXianSenQwQ
    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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions