Commit e635ca86 authored by ale's avatar ale Committed by kl

escaping of dangerous characters

parent 8bd36e37
......@@ -62,6 +62,11 @@
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version>
</dependency>
<!-- REDISSON -->
<dependency>
<groupId>org.redisson</groupId>
......
......@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.*;
import org.apache.commons.text.StringEscapeUtils;
/**
*
......@@ -36,6 +37,9 @@ public class FileController {
// 获取文件名
String fileName = file.getOriginalFilename();
//判断是否为IE浏览器的文件名,IE浏览器下文件名会带有盘符信息
// escaping dangerous characters to prevent XSS
fileName = StringEscapeUtils.escapeHtml4(fileName);
// Check for Unix-style path
int unixSep = fileName.lastIndexOf('/');
// Check for Windows-style path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment