Skip to content

Commit

Permalink
Add file upload fix for QU-4501 to drag-and-drop'd attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
Amelia Magee committed Dec 2, 2024
1 parent d761df7 commit 1b8ba14
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions js/DropZone/DropZone.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ export default class DropZone {
if (valid) {
// add processed files to file store
this.files = [...this.files, ...processedFiles];

//<QU-4501> We need to manually update the datatransfer.files object as it is not updated by the browser due to security reasons
const dataTransfer = new DataTransfer();
let wasFile = false;
for (let i = 0; i < this.files.length; i++) {
if (this.files[i].raw instanceof File){
dataTransfer.items.add(this.files[i].raw);
wasFile = true;
}
}
if (wasFile){
// this guard exists as some js tests do not provide a file type as the input value.
document.getElementById(this.options.inputNodeId).files = dataTransfer.files;
}
//</QU-4501>
}

// fire dropped callback
Expand Down

0 comments on commit 1b8ba14

Please sign in to comment.