This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Description
Hi, may I ask how to disable spring boot from cutting off file extension with RequestMapping please?
My code:
@RequestMapping(value = "/uploaded/{filename}", method = RequestMethod.GET)
public ResponseEntity<byte[]> getUploaded(@PathVariable String filename) throws IOException {
logger.debug("getUploaded filename=" + filename);
HttpHeaders httpHeaders = new HttpHeaders();
Resource file = storageService.loadAsResource(filename);
InputStream inputStream = file.getInputStream();
byte[] data = IOUtils.toByteArray(inputStream);
httpHeaders.setCacheControl(CacheControl.noCache().getHeaderValue());
return new ResponseEntity<>(data, httpHeaders, HttpStatus.OK);
}
With request: localhost:8080/uploaded/a.png or localhost:8080/uploaded/b.jpg
I got logging:
getUploaded filename=a
getUploaded filename=b
So obviously the file extension is removed by spring boot. How to fix this please?