Skip to content

Commit 138f6bf

Browse files
committed
Update Javadoc of FilePart#filename
See gh-26299
1 parent a1cf6bb commit 138f6bf

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

spring-web/src/main/java/org/springframework/http/codec/multipart/FilePart.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,6 +33,14 @@ public interface FilePart extends Part {
3333

3434
/**
3535
* Return the original filename in the client's filesystem.
36+
* <p><strong>Note:</strong> Please keep in mind this filename is supplied
37+
* by the client and should not be used blindly. In addition to not using
38+
* the directory portion, the file name could also contain characters such
39+
* as ".." and others that can be used maliciously.
40+
* @return the original filename, or the empty String if no file has been chosen
41+
* in the multipart form, or {@code null} if not defined or not available
42+
* @see <a href="https://tools.ietf.org/html/rfc7578#section-4.2">RFC 7578, Section 4.2</a>
43+
* @see <a href="https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload">Unrestricted File Upload</a>
3644
*/
3745
String filename();
3846

spring-web/src/main/java/org/springframework/web/multipart/MultipartFile.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ public interface MultipartFile extends InputStreamSource {
5555
* but it typically will not with any other than Opera.
5656
* <p><strong>Note:</strong> Please keep in mind this filename is supplied
5757
* by the client and should not be used blindly. In addition to not using
58-
* the directory portion, the file name could also contain characters * such
58+
* the directory portion, the file name could also contain characters such
5959
* as ".." and others that can be used maliciously.
6060
* @return the original filename, or the empty String if no file has been chosen
6161
* in the multipart form, or {@code null} if not defined or not available
6262
* @see org.apache.commons.fileupload.FileItem#getName()
6363
* @see org.springframework.web.multipart.commons.CommonsMultipartFile#setPreserveFilename
64-
* @see <a href="https://tools.ietf.org/html/rfc7578#section-4.2">RFC 7578, Section 3.4</a>
64+
* @see <a href="https://tools.ietf.org/html/rfc7578#section-4.2">RFC 7578, Section 4.2</a>
6565
* @see <a href="https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload">Unrestricted File Upload</a>
6666
*/
6767
@Nullable

0 commit comments

Comments
 (0)