Skip to content

Commit

Permalink
Make attachments for job requests optional
Browse files Browse the repository at this point in the history
For backwards compatibility some internal clients were sending requests to the multipart endpoint but not sending an attachment field. This worked on the 2.3.x line but on 2.5.x it is enforced more strictly and is throwing 400. The proper thing to do would be to make the clients do the right thing but it would be such a long tail that releasing this fix is more effective short term while that logic is slowly phased out.
  • Loading branch information
tgianos committed Jan 18, 2022
1 parent f781fef commit c18f3fd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,15 @@ public ResponseEntity<Void> submitJob(
@ResponseStatus(HttpStatus.ACCEPTED)
public ResponseEntity<Void> submitJob(
@Valid @RequestPart("request") final JobRequest jobRequest,
@RequestPart("attachment") final MultipartFile[] attachments,
@RequestPart(value = "attachment", required = false) @Nullable final MultipartFile[] attachments,
@RequestHeader(value = FORWARDED_FOR_HEADER, required = false) @Nullable final String clientHost,
@RequestHeader(value = HttpHeaders.USER_AGENT, required = false) @Nullable final String userAgent,
final HttpServletRequest httpServletRequest
) throws GenieException, GenieCheckedException {
log.info(
"[submitJob] Called multipart method to submit job: {}, with {} attachments",
jobRequest,
attachments.length
attachments == null ? 0 : attachments.length
);
this.submitJobWithAttachmentsRate.increment();
return this.handleSubmitJob(jobRequest, attachments, clientHost, userAgent, httpServletRequest);
Expand Down

0 comments on commit c18f3fd

Please sign in to comment.