Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
梁杰芳
slm-fileview
Commits
50dd7c1b
Commit
50dd7c1b
authored
Jan 23, 2021
by
chenkailing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除 Apache-common-text 包,采用 spring 内置的 HtmlUtils 处理 xss 问题
parent
2dd06717
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
pom.xml
server/pom.xml
+0
-5
FileController.java
...rc/main/java/cn/keking/web/controller/FileController.java
+4
-2
No files found.
server/pom.xml
View file @
50dd7c1b
...
...
@@ -62,11 +62,6 @@
<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>
...
...
server/src/main/java/cn/keking/web/controller/FileController.java
View file @
50dd7c1b
...
...
@@ -15,8 +15,9 @@ import org.springframework.web.bind.annotation.RestController;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
import
org.
apache.commons.text.StringEscape
Utils
;
import
org.
springframework.web.util.Html
Utils
;
/**
*
...
...
@@ -39,7 +40,8 @@ public class FileController {
//判断是否为IE浏览器的文件名,IE浏览器下文件名会带有盘符信息
// escaping dangerous characters to prevent XSS
fileName
=
StringEscapeUtils
.
escapeHtml4
(
fileName
);
fileName
=
HtmlUtils
.
htmlEscape
(
fileName
,
StandardCharsets
.
UTF_8
.
name
());
// Check for Unix-style path
int
unixSep
=
fileName
.
lastIndexOf
(
'/'
);
// Check for Windows-style path
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment