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

--- Comment #51 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 209370
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209370&action=edit
Bug 42404: (follow-up) Remove the upload if the batch import job cannot be
enqueued

If enqueueing the BatchImportCoverImages job failed, the zip stored by
_store_upload was left behind until cleanup_database.pl purged it. This
patch deletes it before rethrowing the exception.

The API tests are also improved:
- 'replace' and 'target' were sent as form fields while the spec
  declares them as query parameters, and the mocked enqueue ignored its
  arguments, so nothing checked they reached the job. The tests now use
  query parameters and check the job arguments, including the defaults.
- The stored upload is checked (temporary, file on disk).
- An invalid 'target' is rejected with a 400.
- An enqueue failure returns a 500 and leaves no upload behind.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/cover_images.t
=> SUCCESS: Tests pass!
3. Revert the changes to Koha/REST/V1/CoverImages.pm and repeat 2
=> FAIL: The upload is left behind when the job cannot be enqueued
4. Sign off :-D

Assisted-by: Opus 5.5 (Anthropic)

-- 
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