Skip to content

Commit e59f60e

Browse files
committed
⚡ fix uploading directories
1 parent f756c65 commit e59f60e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

services/ipos/src/routes/pinning.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ app.post('/pinFile', vValidator('form', pinFileRequestSchema), async (c) => {
9090
import: 'car',
9191
},
9292
})
93+
94+
for (const { file } of files) {
95+
const path = `${cid}/${file.name}`
96+
c.executionCtx.waitUntil(c.env.BUCKET.put(keyOf(path), file))
97+
}
98+
9399
} else {
94100
const { content, file: f } = files[0]
95101
cid = (await hashOf(content)).toV0().toString()
@@ -103,9 +109,9 @@ app.post('/pinFile', vValidator('form', pinFileRequestSchema), async (c) => {
103109
Key: cid,
104110
ContentType: f.type,
105111
})
106-
}
107112

108-
c.executionCtx.waitUntil(c.env.BUCKET.put(keyOf(cid), file))
113+
c.executionCtx.waitUntil(c.env.BUCKET.put(keyOf(cid), file))
114+
}
109115

110116
return c.json(
111117
getPinResponse({

0 commit comments

Comments
 (0)