fix: dont save the file to album if no album

This commit is contained in:
Pitu 2021-01-05 16:38:44 +09:00
parent f125011413
commit 92f38085b0
1 changed files with 6 additions and 4 deletions

View File

@ -118,10 +118,12 @@ const start = async () => {
editedAt: moment.unix(file.timestamp).toDate()
};
filesToInsert.push(fileToInsert);
albumsFilesToInsert.push({
albumId: file.albumid,
fileId: file.id
});
if (file.albumid) {
albumsFilesToInsert.push({
albumId: file.albumid,
fileId: file.id
});
}
const filename = file.name;
if (!jetpack.exists(nodePath.join(__dirname, '../../uploads', filename))) continue;