Skip to content

Commit

Permalink
fix: handle empty sublevels
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtsukino committed Jan 16, 2025
1 parent bae2991 commit 6343873
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/entries/Background/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ export async function getCookiesByHost(link: string) {
? Object.keys(links).filter((l) => minimatch(l, link))[0]
: Object.keys(links).filter((l) => urlify(l)?.host === link)[0];

if (!cookieLink) return ret;

for await (const [key, value] of cookiesDb.sublevel(cookieLink).iterator()) {
ret[key] = value;
}
Expand Down Expand Up @@ -409,6 +411,8 @@ export async function getHeadersByHost(link: string) {
? Object.keys(links).filter((l) => minimatch(l, link))[0]
: Object.keys(links).filter((l) => urlify(l)?.host === link)[0];

if (!headerLink) return ret;

for await (const [key, value] of headersDb.sublevel(headerLink).iterator()) {
ret[key] = value;
}
Expand Down

0 comments on commit 6343873

Please sign in to comment.