Skip to content

Commit 109290c

Browse files
author
Alan Shaw
committed
fix: collect all location claims
1 parent de8e9e9 commit 109290c

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/locator/content-claims.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,22 @@ export class ContentClaimsLocator {
7272
const claims = await Claims.read(cid, { serviceURL: this.#serviceURL })
7373
for (const claim of claims) {
7474
if (claim.type === 'assert/location' && claim.range?.length != null) {
75-
this.#cache.set(digest, {
76-
digest,
77-
site: [{
75+
const location = this.#cache.get(digest)
76+
if (location) {
77+
location.site.push({
7878
location: claim.location.map(l => new URL(l)),
7979
range: { offset: claim.range.offset, length: claim.range.length }
80-
}]
81-
})
82-
continue
80+
})
81+
} else {
82+
this.#cache.set(digest, {
83+
digest,
84+
site: [{
85+
location: claim.location.map(l => new URL(l)),
86+
range: { offset: claim.range.offset, length: claim.range.length }
87+
}]
88+
})
89+
}
8390
}
84-
break
8591
}
8692
this.#claimFetched.set(digest, true)
8793
}

0 commit comments

Comments
 (0)