Skip to content

Commit

Permalink
Fix search crash when favicons are malformed
Browse files Browse the repository at this point in the history
- Did a fresh sync with an existing account and noticed search didn't work. Traced it down to the favicons, which seem like they were not properly re-synced, where one had a doc but without the Blob `favIcon` key. This code assumed it was always present, thus i've removed that assumption
  • Loading branch information
poltak committed May 23, 2024
1 parent 2a6e182 commit 7b717be
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/search/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,12 @@ export default class SearchBackground {
.bulkGet(hostnames)

const favIconDataURLs = await Promise.all(
favIcons.filter(Boolean).map(async (f) => ({
hostname: f.hostname,
favIconDataURL: await blobToDataURL(f.favIcon),
})),
favIcons
.filter((f) => f?.favIcon != null)
.map(async (f) => ({
hostname: f.hostname,
favIconDataURL: await blobToDataURL(f.favIcon),
})),
)
const favIconByHostname = fromPairs(
favIconDataURLs.map((f) => [f.hostname, f.favIconDataURL]),
Expand Down

0 comments on commit 7b717be

Please sign in to comment.