fix(club): status file extension
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m12s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 6m12s
This commit is contained in:
@@ -162,12 +162,20 @@ public class Utils {
|
||||
return Uni.createFrom().item(() -> {
|
||||
String mimeType = URLConnection.guessContentTypeFromName(filePair.getKey().getName());
|
||||
|
||||
|
||||
String filename = out_filename;
|
||||
if (filename != null && (filename.length() < 5 || filename.lastIndexOf(
|
||||
'.') <= filename.length() - 6)) {
|
||||
filename += filePair.getKey().getName()
|
||||
.substring(filePair.getKey().getName().lastIndexOf('.'));
|
||||
}
|
||||
|
||||
Response.ResponseBuilder resp = Response.ok(filePair.getValue());
|
||||
resp.type(MediaType.APPLICATION_OCTET_STREAM);
|
||||
resp.header(HttpHeaders.CONTENT_LENGTH, filePair.getValue().length);
|
||||
resp.header(HttpHeaders.CONTENT_TYPE, mimeType);
|
||||
resp.header(HttpHeaders.CONTENT_DISPOSITION,
|
||||
"inline; " + ((out_filename == null) ? "" : "filename=\"" + out_filename + "\""));
|
||||
"inline; " + ((filename == null) ? "" : "filename=\"" + filename + "\""));
|
||||
return resp.build();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user