dossiers: autosave shouldn't send files being uploaded

When a file is being uploaded asynchronosely, hidden input fields
are created by DirectUpload to contain the result of the upload.

However, before the upload finishes, the value of these inputs is not
meaningful. Moreover, it makes the ActiveRecord signature invalid – thus
preventing drafts from being saved.

Exclude these fields from the auto-save.
This commit is contained in:
Pierre de La Morinerie 2019-11-25 18:17:49 +01:00 committed by GitHub Action
parent 64d96646a3
commit c6eab70679

View file

@ -62,7 +62,7 @@ export default class AutosaveController {
// exclude them from the draft (by disabling them).
// (Also Safari has issue with FormData containing empty file inputs)
const fileInputs = form.querySelectorAll(
'input[type="file"]:not([disabled])'
'input[type="file"]:not([disabled]), .editable-champ-piece_justificative input:not([disabled])'
);
fileInputs.forEach(fileInput => (fileInput.disabled = true));