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
jenkins
slm-fileview
Commits
e635ca86
Commit
e635ca86
authored
Jan 15, 2021
by
ale
Committed by
kl
Jan 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
escaping of dangerous characters
parent
8bd36e37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
pom.xml
server/pom.xml
+5
-0
FileController.java
...rc/main/java/cn/keking/web/controller/FileController.java
+4
-0
No files found.
server/pom.xml
View file @
e635ca86
...
...
@@ -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>
...
...
server/src/main/java/cn/keking/web/controller/FileController.java
View file @
e635ca86
...
...
@@ -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
...
...
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