Skip to content

Commit

Permalink
fix: file selection path (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
janmichek authored Apr 30, 2024
1 parent 124e9c1 commit 448d3cd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/ContractsFileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ const hasSelectedFiles = computed(() => {
function addInputFilesToSelectedFiles() {
const isFirstFilesAddition = !hasSelectedFiles.value
// chrome workaround to manually set webkitRelativePath
Array.from(fileInput.value.files).forEach(file => {
Object.defineProperty(file, 'webkitRelativePath', {
value: file.name,
})
})
selectedFiles.value.push(...fileInput.value.files)
emit('update:selected-files', selectedFiles.value)
if (isFirstFilesAddition) {
Expand All @@ -82,9 +89,7 @@ function addInputFilesToSelectedFiles() {
function addDroppedFilesToSelectedFiles(isFirstFilesAddition) {
const fileList = new DataTransfer()
selectedFiles.value.forEach(file => {
return fileList.items.add(file)
})
selectedFiles.value.forEach(file => fileList.items.add(file))
emit('update:selected-files', fileList.files)
if (isFirstFilesAddition) {
Expand Down

0 comments on commit 448d3cd

Please sign in to comment.