Fix server exit hang on MacOS, cleanup, include directories in zips, natural sort.

This commit is contained in:
Leo Vasanko
2023-11-07 16:54:46 -08:00
parent 63f6008a0a
commit 37167a41a6
6 changed files with 37 additions and 33 deletions

View File

@@ -55,11 +55,16 @@ async function sendChunk(file: File, start: number, end: number) {
}
}
async function uploadFileChangeHandler(event: Event) {
async function uploadHandler(event: Event) {
const target = event.target as HTMLInputElement
const chunkSize = 1 << 20
if (target && target.files && target.files.length > 0) {
const file = target.files[0]
if (!target?.files?.length) {
documentStore.error = 'No files selected'
return
}
for (const idx in target.files) {
const file = target.files[idx]
console.log('Uploading', file)
const numChunks = Math.ceil(file.size / chunkSize)
const document = documentStore.pushUploadingDocuments(file.name)
open('bottomRight')
@@ -78,14 +83,14 @@ async function uploadFileChangeHandler(event: Event) {
<template>
<input
ref="fileUploadButton"
@change="uploadFileChangeHandler"
@change="uploadHandler"
class="upload-input"
type="file"
multiple
/>
<input
ref="folderUploadButton"
@change="uploadFileChangeHandler"
@change="uploadHandler"
class="upload-input"
type="file"
webkitdirectory