refactor
This commit is contained in:
@@ -322,7 +322,7 @@ const useDocumentUploads = ({
|
||||
items.map(async (item, index) => {
|
||||
if (item.kind !== 'file') return;
|
||||
|
||||
const fileFromItem = typeof item.getAsFile === 'function' ? item.getAsFile() : null;
|
||||
const fileFromItem = item.getAsFile?.() ?? null;
|
||||
if (fileFromItem) {
|
||||
const relativePath = (fileFromItem as File & { webkitRelativePath?: string })?.webkitRelativePath ?? '';
|
||||
const segments = relativePath
|
||||
@@ -334,9 +334,9 @@ const useDocumentUploads = ({
|
||||
pushFile(fileFromItem, segments);
|
||||
}
|
||||
|
||||
if (typeof item.webkitGetAsEntry === 'function') {
|
||||
if ((item as ExtendedDataTransferItem).webkitGetAsEntry) {
|
||||
try {
|
||||
const entry = item.webkitGetAsEntry();
|
||||
const entry = (item as ExtendedDataTransferItem).webkitGetAsEntry?.();
|
||||
if (entry) {
|
||||
await walkEntry(entry, []);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user