File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 30
30
31
31
<name >Open Feign Forms Core</name >
32
32
<dependencies >
33
+ <dependency >
34
+ <groupId >org.apache.commons</groupId >
35
+ <artifactId >commons-text</artifactId >
36
+ <version >1.12.0</version >
37
+ </dependency >
33
38
<dependency >
34
39
<groupId >org.projectlombok</groupId >
35
40
<artifactId >lombok</artifactId >
Original file line number Diff line number Diff line change 28
28
import java .io .IOException ;
29
29
import java .util .Collection ;
30
30
import java .util .List ;
31
+ import org .apache .commons .text .StringEscapeUtils ;
31
32
import lombok .val ;
32
33
import org .springframework .boot .autoconfigure .SpringBootApplication ;
33
34
import org .springframework .http .HttpStatus ;
@@ -166,8 +167,9 @@ public ResponseEntity<String> uploadUnknownType(@RequestPart("file") MultipartFi
166
167
@ PostMapping (path = "/upload/form_data" , consumes = MULTIPART_FORM_DATA_VALUE )
167
168
public ResponseEntity <String > uploadFormData (@ RequestPart ("file" ) MultipartFile file ) {
168
169
val status = file != null ? OK : I_AM_A_TEAPOT ;
170
+ String sanitizedFilename = StringEscapeUtils .escapeHtml4 (file .getOriginalFilename ());
169
171
return ResponseEntity .status (status )
170
- .body (file . getOriginalFilename () + ':' + file .getContentType ());
172
+ .body (sanitizedFilename + ':' + file .getContentType ());
171
173
}
172
174
173
175
@ PostMapping (path = "/submit/url" , consumes = APPLICATION_FORM_URLENCODED_VALUE )
You can’t perform that action at this time.
0 commit comments