Skip to content

Commit

Permalink
fix: allow relativePath as alternative to webkitRelativePath
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Sep 28, 2024
1 parent 6b601b8 commit e5fd102
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/fileCollectionFromFileList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ export async function fileCollectionFromFileList(
const item = {
name: file.name,
size: file.size,
//@ts-expect-error We allow file.path as alternative to webkitRelativePath
relativePath: file.webkitRelativePath || file.path || file.name,
relativePath:
//@ts-expect-error We allow file.relativePath or file.path as alternative to webkitRelativePath
file.webkitRelativePath || file.relativePath || file.path || file.name,
lastModified: file.lastModified,
text: () => file.text(),
arrayBuffer: () => file.arrayBuffer(),
Expand Down
5 changes: 3 additions & 2 deletions src/fileCollectionFromFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ export async function fileCollectionFromFiles(
const item = {
name: file.name,
size: file.size,
//@ts-expect-error We allow file.path as alternative to webkitRelativePath
relativePath: file.webkitRelativePath || file.path || file.name,
relativePath:
//@ts-expect-error We allow file.relativePath or file.path as alternative to webkitRelativePath
file.webkitRelativePath || file.relativePath || file.path || file.name,
lastModified: file.lastModified,
text: () => file.text(),
arrayBuffer: () => file.arrayBuffer(),
Expand Down

0 comments on commit e5fd102

Please sign in to comment.