Skip to content

Commit

Permalink
Change attachments in DB to attachments on Disk - Special characters …
Browse files Browse the repository at this point in the history
…in download filename #2
  • Loading branch information
tomaszkononowicz committed Dec 1, 2018
1 parent b568a90 commit 11c378f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public ResponseEntity downloadFile(@RequestParam("id") long id,

try {
response.setContentType(FileUtils.getMimeType(FilenameUtils.getExtension(attachment.getFileName())));
response.setHeader("Content-Disposition", "attachment; filename=UTF-8''" + URLEncoder.encode(attachment.getFileName(),"UTF-8"));
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(attachment.getFileName(),"UTF-8").replace("+", "%20"));
IOUtils.copy(inputStream, response.getOutputStream());
} catch (IOException ex) {
Logger.getLogger(AttachmentControler.class.getName()).log(Level.SEVERE, null, ex);
Expand Down

0 comments on commit 11c378f

Please sign in to comment.