mirror of
https://github.com/kekingcn/kkFileView.git
synced 2026-04-21 05:18:37 +00:00
1、文本文档加入缓存 2、安全修复XSS(跨站脚本攻击) 3、美化404、500报错等 5、新增 SVG格式预览 5、ofd优化印章渲染兼容性 Co-authored-by: gaoxiongzaq <admin@cxcp.com>
53 lines
1.5 KiB
Java
53 lines
1.5 KiB
Java
package cn.keking.service.impl;
|
|
|
|
import cn.keking.model.FileAttribute;
|
|
import cn.keking.service.FilePreview;
|
|
import cn.keking.utils.KkFileUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.ui.Model;
|
|
|
|
/**
|
|
* Created by kl on 2018/1/17.
|
|
* Content :其他文件
|
|
*/
|
|
@Service
|
|
public class OtherFilePreviewImpl implements FilePreview {
|
|
|
|
|
|
@Override
|
|
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
|
return this.notSupportedFile(model, fileAttribute, "系统还不支持该格式文件的在线预览");
|
|
}
|
|
|
|
/**
|
|
* 通用的预览失败,导向到不支持的文件响应页面
|
|
*
|
|
* @return 页面
|
|
*/
|
|
public String notSupportedFile(Model model, FileAttribute fileAttribute, String errMsg) {
|
|
return this.notSupportedFile(model, fileAttribute.getSuffix(), errMsg);
|
|
}
|
|
|
|
/**
|
|
* 通用的预览失败,导向到不支持的文件响应页面
|
|
*
|
|
* @return 页面
|
|
*/
|
|
public String notSupportedFile(Model model, String errMsg) {
|
|
return this.notSupportedFile(model, "未知", errMsg);
|
|
}
|
|
|
|
/**
|
|
* 通用的预览失败,导向到不支持的文件响应页面
|
|
*
|
|
* @return 页面
|
|
*/
|
|
public String notSupportedFile(Model model, String fileType, String errMsg) {
|
|
model.addAttribute("fileType", KkFileUtils.htmlEscape(fileType));
|
|
model.addAttribute("msg", KkFileUtils.htmlEscape(errMsg));
|
|
return NOT_SUPPORTED_FILE_PAGE;
|
|
}
|
|
|
|
|
|
}
|