Skip to content

Commit a7413ea

Browse files
committed
Add recommendation for original multipart filename
See gh-26299
1 parent c3c36ab commit a7413ea

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ public interface FilePart extends Part {
3636
* <p><strong>Note:</strong> Please keep in mind this filename is supplied
3737
* by the client and should not be used blindly. In addition to not using
3838
* the directory portion, the file name could also contain characters such
39-
* as ".." and others that can be used maliciously.
39+
* as ".." and others that can be used maliciously. It is recommended to not
40+
* use this filename directly. Preferably generate a unique one and save
41+
* this one one somewhere for reference, if necessary.
4042
* @return the original filename, or the empty String if no file has been chosen
4143
* in the multipart form, or {@code null} if not defined or not available
4244
* @see <a href="https://tools.ietf.org/html/rfc7578#section-4.2">RFC 7578, Section 4.2</a>

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public interface MultipartFile extends InputStreamSource {
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
5858
* the directory portion, the file name could also contain characters such
59-
* as ".." and others that can be used maliciously.
59+
* as ".." and others that can be used maliciously. It is recommended to not
60+
* use this filename directly. Preferably generate a unique one and save
61+
* this one one somewhere for reference, if necessary.
6062
* @return the original filename, or the empty String if no file has been chosen
6163
* in the multipart form, or {@code null} if not defined or not available
6264
* @see org.apache.commons.fileupload.FileItem#getName()

src/docs/asciidoc/web/webflux.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3002,8 +3002,8 @@ for the body. This allows a variety of async responses with `ResponseEntity` as
30023002
asynchronously at a later point. This allows the response status and headers to vary
30033003
depending on the outcome of asynchronous request handling.
30043004
* `Mono<ResponseEntity<Mono<T>>>` or `Mono<ResponseEntity<Flux<T>>>` are yet another
3005-
possible, albeit less common alternative. They provides the response status and headers
3006-
asynchronously first and then the response body, also asynchronously at a second point later.
3005+
possible, albeit less common alternative. They provide the response status and headers
3006+
asynchronously first and then the response body, also asynchronously, second.
30073007

30083008

30093009
[[webflux-ann-jackson]]

0 commit comments

Comments
 (0)