Skip to content

Commit

Permalink
Merge pull request #312 from kodadot/revert--dont-redirect-to-nftstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiival authored Jun 22, 2024
2 parents def0e8d + 681af48 commit f674f89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions services/image/src/routes/ipfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ app.get('/*', async (c) => {
// 4. upload object to r2
// ----------------------------------------
console.log('step 4', url.toString())
const ipfsNftstorage = toIpfsGw(url.toString(), 'w3s')
console.log('ipfsNftstorage', ipfsNftstorage)
const status = await fetchIPFS({
path: fullPath,
})
Expand All @@ -143,7 +141,14 @@ app.get('/*', async (c) => {
)
}

return c.redirect(ipfsNftstorage)
// 5. return object from r2
// ----------------------------------------
console.log('step 5')
const newObject = await c.env.MY_BUCKET.get(objectName)

if (newObject !== null) {
return renderR2Object(newObject, newObject?.httpMetadata?.contentType)
}
})

app.delete('/*', async (c) => {
Expand Down
2 changes: 1 addition & 1 deletion services/image/src/tests/type-endpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ test('type-endpoint - 200 - image - original', async () => {
expect(data).toMatchInlineSnapshot(`
Blob {
Symbol(kHandle): Blob {},
Symbol(kLength): 86783,
Symbol(kLength): 631349,
Symbol(kType): "image/png",
}
`)
Expand Down

0 comments on commit f674f89

Please sign in to comment.