Skip to content

Commit

Permalink
Truncate long text fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mrginglymus committed Jan 30, 2021
1 parent 70de35e commit 6397e47
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
class GitHubChecksDetails {
private final ChecksDetails details;

private static final int MAX_MESSAGE_SIZE_TO_CHECKS_API = 65_535;

/**
* Construct with the given {@link ChecksDetails}.
*
Expand Down Expand Up @@ -171,9 +173,9 @@ public Optional<Output> getOutput() {
Output output = new Output(
checksOutput.getTitle().orElseThrow(
() -> new IllegalArgumentException("Title of output is required but not provided")),
checksOutput.getSummary().orElseThrow(
checksOutput.getSummary(MAX_MESSAGE_SIZE_TO_CHECKS_API).orElseThrow(
() -> new IllegalArgumentException("Summary of output is required but not proviede")))
.withText(checksOutput.getText().orElse(null));
.withText(checksOutput.getText(MAX_MESSAGE_SIZE_TO_CHECKS_API).orElse(null));
checksOutput.getChecksAnnotations().stream().map(this::getAnnotation).forEach(output::add);
checksOutput.getChecksImages().stream().map(this::getImage).forEach(output::add);
return Optional.of(output);
Expand Down

0 comments on commit 6397e47

Please sign in to comment.