Added hash comparison to duplicate avoidance.
This commit is contained in:
@@ -4,7 +4,7 @@ const config = require('config');
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const interpolate = require('../interpolate');
|
||||
const textToStream = require('./textToStream');
|
||||
// const textToStream = require('./textToStream');
|
||||
const save = require('./save');
|
||||
|
||||
async function writeToIndex(posts, profilePaths, user, args) {
|
||||
@@ -22,6 +22,7 @@ async function writeToIndex(posts, profilePaths, user, args) {
|
||||
indexed: now,
|
||||
score: post.score,
|
||||
title: post.title,
|
||||
hash: post.hash,
|
||||
};
|
||||
|
||||
if (post.previewFallback) {
|
||||
@@ -43,7 +44,8 @@ async function writeToIndex(posts, profilePaths, user, args) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return save(filepath, textToStream(yaml.safeDump(data)));
|
||||
// return save(filepath, textToStream(yaml.safeDump(data)));
|
||||
return save(filepath, Buffer.from(yaml.safeDump(data), 'utf8'));
|
||||
}
|
||||
|
||||
module.exports = writeToIndex;
|
||||
|
||||
Reference in New Issue
Block a user