Skip to content

Commit

Permalink
Make ghostery_id optional
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-classen committed Aug 3, 2023
1 parent 10f6097 commit 062509f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/adblocker/src/engine/metadata/patterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface IPattern {
readonly organization: string | null;
readonly alias: string | null;
readonly website_url: string | null;
readonly ghostery_id: string;
readonly ghostery_id: string | null;
readonly domains: string[];
readonly filters: string[];
}
Expand Down Expand Up @@ -126,7 +126,7 @@ export function getSerializedSize(pattern: IPattern): number {
sizeOfUTF8(pattern.organization || '') +
sizeOfUTF8(pattern.alias || '') +
sizeOfUTF8(pattern.website_url || '') +
sizeOfUTF8(pattern.ghostery_id) +
sizeOfUTF8(pattern.ghostery_id || '') +
sizeOfDomains +
sizeOfFilters
);
Expand All @@ -139,7 +139,7 @@ export function serialize(pattern: IPattern, view: StaticDataView) {
view.pushUTF8(pattern.organization || '');
view.pushUTF8(pattern.alias || '');
view.pushUTF8(pattern.website_url || '');
view.pushUTF8(pattern.ghostery_id);
view.pushUTF8(pattern.ghostery_id || '');

view.pushLength(pattern.domains.length);
for (const domain of pattern.domains) {
Expand All @@ -159,7 +159,7 @@ export function deserialize(view: StaticDataView): IPattern {
const organization = view.getUTF8() || null;
const alias = view.getUTF8() || null;
const website_url = view.getUTF8() || null;
const ghostery_id = view.getUTF8();
const ghostery_id = view.getUTF8() || null;

const numberOfDomains = view.getLength();
const domains = [];
Expand Down

0 comments on commit 062509f

Please sign in to comment.