Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed Dec 30, 2024
1 parent 68c1e32 commit fcb444a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public boolean enforced(final AwsServiceCache awsservice, final String siteId, f
Long maxContentLength = getMaxContentLength(value);

if (maxContentLength != null) {
enforced = (contentLength == null || contentLength == 0)
|| (contentLength > maxContentLength);
enforced =
(contentLength == null || contentLength == 0) || (contentLength > maxContentLength);
}

return enforced;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public ApiRequestHandlerResponse get(final ApiGatewayRequestEvent event,

if (map.containsKey("ocrStatus")) {

if (OcrScanStatus.SUCCESSFUL.name().equalsIgnoreCase(map.get("ocrStatus").toString())) {
if (isOcrStatus(map, OcrScanStatus.SUCCESSFUL) || isOcrStatus(map, OcrScanStatus.SKIPPED)) {

S3Service s3 = awsservice.getExtension(S3Service.class);

Expand Down Expand Up @@ -164,6 +164,10 @@ public ApiRequestHandlerResponse get(final ApiGatewayRequestEvent event,
return new ApiRequestHandlerResponse(status, resp);
}

private boolean isOcrStatus(final Map<String, Object> map, final OcrScanStatus status) {
return status.name().equalsIgnoreCase(map.get("ocrStatus").toString());
}

/**
* Get S3 Content Urls.
*
Expand Down Expand Up @@ -323,7 +327,8 @@ public ApiRequestHandlerResponse put(final ApiGatewayRequestEvent event,
DocumentOcrService ocrService = awsservice.getExtension(DocumentOcrService.class);
ocrService.set(awsservice, siteId, documentId, userId, content, contentType);

ApiMapResponse resp = new ApiMapResponse();
ApiMapResponse resp =
new ApiMapResponse(Map.of("message", "Set OCR for documentId '" + documentId + "'"));
return new ApiRequestHandlerResponse(SC_OK, resp);
}

Expand Down

0 comments on commit fcb444a

Please sign in to comment.