@adguard/diff-builder
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -8,2 +8,8 @@ # Diff Builder Changelog | ||
## [1.0.6] - 2023-12-26 | ||
### Fixed | ||
- Handle user agent headers in the filter content. | ||
## [1.0.5] - 2023-12-25 | ||
@@ -10,0 +16,0 @@ |
{ | ||
"name": "@adguard/diff-builder", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A tool for generating differential updates for filter lists.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -288,2 +288,8 @@ import path from 'path'; | ||
let userAgent: string | undefined; | ||
// User agent tag. | ||
if (newFileSplitted[0].startsWith('![') || newFileSplitted[0].startsWith('[')) { | ||
userAgent = newFileSplitted.shift(); | ||
} | ||
// Remove tags 'Diff-Path' and 'Checksum' from new filterContent. | ||
@@ -295,2 +301,6 @@ newFileSplitted = removeTag(DIFF_PATH_TAG, removeTag(CHECKSUM_TAG, newFileSplitted)); | ||
if (userAgent !== undefined) { | ||
newFileSplitted.unshift(userAgent); | ||
} | ||
// If filter had checksum, calculate and insert a new checksum tag at the start of the filter | ||
@@ -300,3 +310,9 @@ if (hasChecksum(filterContent)) { | ||
const checksumTag = createTag(CHECKSUM_TAG, updatedChecksum); | ||
newFileSplitted.unshift(checksumTag); | ||
if (userAgent !== undefined) { | ||
// Insert Checksum after the userAgent header. | ||
newFileSplitted.splice(1, 0, checksumTag); | ||
} else { | ||
newFileSplitted.unshift(checksumTag); | ||
} | ||
} | ||
@@ -303,0 +319,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
351505
7139