https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42383

--- Comment #200 from Matt Blenkinsop <[email protected]> ---
Created attachment 210509
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210509&action=edit
Bug 42383: (QA follow-up) Reject a return date that cannot be parsed

POST /checkins validates return_date as a date-time, then parses it with
dt_from_string( ..., 'iso' ). Some valid date-times are not parsed, e.g.
with fractions of a second (2025-01-15T10:00:00.123Z), and
dt_from_string dies, so the request fails with a 500.

This patch addresses point 1 of comment #139. Like the due_date of
POST /checkouts/{checkout_id}/renewal, the parsing is guarded, and a
return date that cannot be parsed is rejected with the standard
invalid_parameter_value 400 response, pointing at /body/return_date.
The error code is documented in the spec.

Test plan:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/checkins.t
=> FAIL: A return date with fractions of a second returns 500
2. Apply this patch
3. Run:
  k$ yarn api:bundle
  k$ restart_all
  k$ prove t/db_dependent/api/v1/checkins.t xt/api.t
=> SUCCESS: Tests pass!
4. Sign off :-D

Assisted-by: Opus 5.5 (Anthropic)
Signed-off-by: Matt Blenkinsop <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to