Skip to content

Commit

Permalink
fix: dudewhere key for V0 CID in path (#69)
Browse files Browse the repository at this point in the history
DUDEWHERE keys use base32 encoded V1 CIDs. So for requests using V0 CIDs
we were unable to find in DUDEWHERE.
  • Loading branch information
Alan Shaw authored Jul 31, 2023
1 parent 755cfe5 commit 85d812c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Dagula } from 'dagula'
import { CarReader } from '@ipld/car'
import { parseCid, HttpError, toIterable } from '@web3-storage/gateway-lib/util'
import { base32 } from 'multiformats/bases/base32'
import { BatchingR2Blockstore } from './lib/blockstore.js'
import { version } from '../package.json'
import { ContentClaimsIndex } from './lib/dag-index/content-claims.js'
Expand Down Expand Up @@ -74,7 +75,7 @@ export function withIndexSources (handler) {
/** @type {string|undefined} */
let cursor
while (true) {
const results = await env.DUDEWHERE.list({ prefix: `${ctx.dataCid}/`, cursor })
const results = await env.DUDEWHERE.list({ prefix: `${ctx.dataCid.toV1().toString(base32)}/`, cursor })
if (!results || !results.objects.length) break

// if the first encountered item is a index rollup, use it
Expand Down

0 comments on commit 85d812c

Please sign in to comment.