Don't attempt to save index when there are no posts or profile details (complained about directory not existing)

This commit is contained in:
DebaucheryLibrarian 2024-09-11 05:16:56 +02:00
parent 44cdd37e49
commit a68493d0fa
2 changed files with 4 additions and 4 deletions

View File

@ -29,6 +29,10 @@ async function writeToIndex(posts, profilePaths, user) {
posts: newAndUpdatedEntries.concat(user.indexed.original),
};
if (!data.profile.image && !data.profile.description && !data.posts.length) {
return;
}
return fs.writeFile(filename, yaml.safeDump(data));
}

View File

@ -1,14 +1,10 @@
'use strict';
const config = require('config');
const Promise = require('bluebird');
const fs = require('fs-extra');
const yaml = require('js-yaml');
const getIndex = require('./getIndex.js');
const getArchivePostIds = require('../archives/getArchivePostIds.js');
const curateUser = require('../curate/user.js');
const interpolate = require('../interpolate.js');
async function getUser(username, reddit) {
try {