Created
June 28, 2019 06:39
-
-
Save Webmobsoft/ad7624a7295ae914194f520e65033183 to your computer and use it in GitHub Desktop.
Download Using Hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GetMapping(value = ["downloadFile/{hash}"], produces = [APPLICATION_JSON_VALUE]) | |
fun downloadFileByHash(@PathVariable hash:String):ResponseEntity<Resource>{ | |
val inputStream = InputStreamResource(proxy.openAttachment(SecureHash.parse(hash))) | |
return ResponseEntity.ok().header( | |
HttpHeaders.CONTENT_DISPOSITION, | |
"attachment; filename=\"$hash.zip\"" | |
).body(inputStream) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment