Skip to content

Commit

Permalink
Fix a 404 test case
Browse files Browse the repository at this point in the history
  • Loading branch information
shierote authored and Buzzardo committed Oct 10, 2023
1 parent c128ccf commit 879c9e5
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public String listUploadedFiles(Model model) throws IOException {
public ResponseEntity<Resource> serveFile(@PathVariable String filename) {

Resource file = storageService.loadAsResource(filename);

if (file == null)
return ResponseEntity.notFound().build();

return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + file.getFilename() + "\"").body(file);
}
Expand Down

0 comments on commit 879c9e5

Please sign in to comment.