-
-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Discussed in #906
Originally posted by joel-s October 2, 2025
I'm using TusUploady with a drop zone to send files.
About half or a third of the time, TusUploady stops sending the metadata from my useRequestPreSend hook. It always sends all the metadata for the first file, but after one or two files it stops sending the useRequestPreSend metadata and only sends the metadata passed to UploadDropZone. This causes uploads to fail because the server can't read the names of files.
Any ideas what might be causing this? I'm open to debugging suggestions. I can't post the whole source code, but here are some relevant parts:
<TusUploady
destination={{
url: `${import.meta.env.VITE_BACKEND_URL}/v1/uploads`,
headers: {
Authorization: `Bearer ${accessToken}`,
},
}}
resumeHeaders={{
// Include the Authorization header for resume requests (HEAD)
Authorization: `Bearer ${accessToken}`,
}}
autoUpload
forgetOnSuccess
sendDataOnCreate
>const DropZone: React.FC<DropZoneProps> = ({ basePath, className, children }: DropZoneProps) => {
useRequestPreSend(({ items }) => {
const name = items[0]?.file.name;
return {
options: {
params: {
filename: name,
},
},
};
});
return (
<UploadDropZone
id="upload-drop-zone"
className={twMerge(
"tw:flex tw:h-full tw:w-full tw:flex-col tw:justify-between tw:p-3",
className,
styles.dropZone,
)}
onDragOverClassName={styles.dragOver}
htmlDirContentParams={{ recursive: true, withFullPath: true }}
params={{ base_path: basePath }}
>I checked if useRequestPreSend was ever invoked with 0 items or a missing filename, and the answer is no. I think it's not getting called at all in the failure cases.