feat: better file normalization (#10024)

* feat: better file normalization

* fix lint

* fix png detection

* optimize

* fix type
This commit is contained in:
David Luzar
2025-09-25 22:26:58 +02:00
committed by GitHub
parent a89a03c66c
commit a8acc8212d
4 changed files with 57 additions and 54 deletions

View File

@@ -470,13 +470,14 @@ export const parseDataTransferEvent = async (
Array.from(items || []).map(
async (item): Promise<ParsedDataTransferItem | null> => {
if (item.kind === "file") {
const file = item.getAsFile();
let file = item.getAsFile();
if (file) {
const fileHandle = await getFileHandle(item);
file = await normalizeFile(file);
return {
type: file.type,
kind: "file",
file: await normalizeFile(file),
file,
fileHandle,
};
}