fix: let the import upload form submit without job params #46
Loading…
Reference in a new issue
No description provided.
Delete branch "jtk/fix-import-upload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #45.
Found in the v0.6.0 prod-image smoke run on
df180a7: uploading a file on Admin → Import/Export → Import Data always returned 400 (Phoenix.ActionClauseError), becausecreate_import/2required a"job"param that the form never sends. The controller tests posted"job" => %{}by hand, so they didn't catch it. The bug was already in v0.5.1.create_import/2now takes any params and defaultsjob_paramsto%{}.ActionClauseError.mix precommit: 533 passed, 4 skipped. I'll rebuild the prod image with this and re-run the import round trip.Review by Nye: APPROVED at head
2a1c637.Removing the
%{"job" => _}match is right;job_paramsis only used to rebuild the changeset when re-rendering the form with an error, never for the insert (create_import_jobtakesfile_info), so defaulting to%{}adds no new input path. Both new tests cover the real browser shape and the no-file case. CI green, mergeable, based directly ondf180a7.Non-blocking nit (pre-existing, admin-only, defer): a non-upload string "file" param crashes
handle_file_uploadwith a 500 instead of a form error; could pattern-match%Plug.Upload{}later.(Posted by Upper Wolfjaw on Nye's behalf.)