This commit is contained in:
@@ -610,10 +610,12 @@ public class ApiController {
|
||||
String encodedFilename = URLEncoder.encode(filename, StandardCharsets.UTF_8)
|
||||
.replace("+", "%20");
|
||||
|
||||
String safeFilename = filename.replaceAll("[^\\x00-\\x7F]", "_");
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION,
|
||||
"attachment; filename*=UTF-8''" + encodedFilename)
|
||||
"attachment; filename=\"" + safeFilename + "\"; filename*=UTF-8''" + encodedFilename)
|
||||
.body(bytes);
|
||||
} catch (FileEntityNotFoundException e) {
|
||||
Map<String, Object> errorData = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user