diff --git a/category-syncer.js b/category-syncer.js index 8bb7e8f..2e1bba3 100644 --- a/category-syncer.js +++ b/category-syncer.js @@ -101,8 +101,8 @@ class CategorySyncer extends EventEmitter { // This gives us the subtree we're interested in let tree = this._buildTree(categories, names, articleCounts, images, true); - // Keep unpruned tree for image sync (same subtree, but not pruned) - const unprunedTree = tree; + // Deep copy tree for unpruned version (before pruning modifies it) + const unprunedTree = JSON.parse(JSON.stringify(tree)); // Ensure directory exists await fs.mkdir(this.cacheDir, { recursive: true });