Skip to content

Commit

Permalink
⚡ fix uploading directories
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiival committed Oct 12, 2024
1 parent f756c65 commit e59f60e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions services/ipos/src/routes/pinning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ app.post('/pinFile', vValidator('form', pinFileRequestSchema), async (c) => {
import: 'car',
},
})

for (const { file } of files) {
const path = `${cid}/${file.name}`
c.executionCtx.waitUntil(c.env.BUCKET.put(keyOf(path), file))
}

} else {
const { content, file: f } = files[0]
cid = (await hashOf(content)).toV0().toString()
Expand All @@ -103,9 +109,9 @@ app.post('/pinFile', vValidator('form', pinFileRequestSchema), async (c) => {
Key: cid,
ContentType: f.type,
})
}

c.executionCtx.waitUntil(c.env.BUCKET.put(keyOf(cid), file))
c.executionCtx.waitUntil(c.env.BUCKET.put(keyOf(cid), file))
}

return c.json(
getPinResponse({
Expand Down

0 comments on commit e59f60e

Please sign in to comment.