Skip to content

Commit

Permalink
fix: relativePath should always contain file.name and not '.' (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny authored Oct 28, 2022
1 parent fe53c7c commit bfd802c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/fileCollectionFromFileList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export async function fileCollectionFromFileList(
fileCollectionItems.push({
name: file.name,
size: file.size,
relativePath: file.webkitRelativePath || file.name,
//@ts-expect-error We allow file.path as alternative to webkitRelativePath
relativePath: file.webkitRelativePath || file.path || file.name,
lastModified: file.lastModified,
text: () => file.text(),
arrayBuffer: () => file.arrayBuffer(),
Expand Down
2 changes: 1 addition & 1 deletion src/fileCollectionFromFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function fileCollectionFromFiles(
name: file.name,
size: file.size,
//@ts-expect-error We allow file.path as alternative to webkitRelativePath
relativePath: file.webkitRelativePath || file.path || '.',
relativePath: file.webkitRelativePath || file.path || file.name,
lastModified: file.lastModified,
text: () => file.text(),
arrayBuffer: () => file.arrayBuffer(),
Expand Down

0 comments on commit bfd802c

Please sign in to comment.