adamsaghy commented on code in PR #4697:
URL: https://github.com/apache/fineract/pull/4697#discussion_r2115310729
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/export/S3DatatableReportExportServiceImpl.java:
##########
@@ -51,9 +52,20 @@ public ResponseHolder export(String reportName,
MultivaluedMap<String, String> q
isSelfServiceUserReport);
try (ByteArrayOutputStream byteArrayOutputStream = new
ByteArrayOutputStream()) {
output.write(byteArrayOutputStream);
+ byte[] fileBytes = byteArrayOutputStream.toByteArray();
+ if (fileBytes.length == 0) {
+ throw new IllegalStateException("Can not upload empty
report content to S3");
+ }
+ String bucketName =
properties.getReport().getExport().getS3().getBucketName();
+ if (StringUtils.isBlank(bucketName)) {
+ throw new IllegalStateException("S3 bucket name is not
configured");
+ }
String folder =
configurationDomainService.retrieveReportExportS3FolderName();
String filePath =
DatatableExportUtil.generateS3DatatableExportFileName(AWS_S3_MAXIMUM_KEY_LENGTH,
folder, "csv",
reportName, reportParams);
+ if (fileBytes.length > AWS_S3_MAXIMUM_KEY_LENGTH) {
Review Comment:
yes please
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]