Skip to content

Commit

Permalink
fix: impex uses anonymous filenames for attachment blobs
Browse files Browse the repository at this point in the history
  • Loading branch information
lgersman committed Mar 31, 2023
1 parent 0ce828c commit 6a47bac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ hooks.addFilter(
for (const entry of _links_self) {
const href = entry["href"];

let path = href.split(/[\\/]/);

const filename =
`slice-${sliceIndex.toString().padStart(4, "0")}-` + path.pop();
//path.push(filename);
//path = path.join("//");
`slice-${sliceIndex.toString().padStart(4, "0")}-attachment.blob`;

await fetch(href).then(async (response) => {
attachmentFileHandle = await chunkDirHandle.getFileHandle(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ hooks.addFilter(

const localAttachmentFileHandle = await chunkDirHandle
.getFileHandle(localAttachmentFilename)
.catch((NotFoundError)=>{
return chunkDirHandle.getFileHandle(`slice-${sliceIndex.toString().padStart(4, "0")}-attachment.blob`);
})
.catch((e) => {
console.log(localAttachmentFilename);
return Promise.reject(e);
Expand Down

0 comments on commit 6a47bac

Please sign in to comment.