From 854d55618af43f8ec67f9c57a89a369679518e11 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 11 Sep 2024 05:16:54 +0200 Subject: [PATCH] Fixed profile description not saving when user has avatar. --- .gitignore | 1 + src/save/profileDetails.js | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 7e8df5b..c692139 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/ config/*.js !config/default.js output/ +dist/ diff --git a/src/save/profileDetails.js b/src/save/profileDetails.js index 41522ba..c42d0ca 100644 --- a/src/save/profileDetails.js +++ b/src/save/profileDetails.js @@ -14,18 +14,16 @@ function saveProfileDetails(user) { if(config.library.profile.avoidAvatar && new urlPattern('http(s)\\://(www.)redditstatic.com/avatars/:id(.:ext)(?:query)').match(image)) { console.log('\x1b[33m%s\x1b[0m', `Ignoring standard avatar profile image for '${user.name}'`); + } else { + const filepath = interpolate(config.library.profile.image, user, null, { + // pass profile image as item to interpolate extension variable + url: image + }); - return user; + fetchItem(image).then(stream => save(filepath, stream)).catch(error => { + console.log('\x1b[33m%s\x1b[0m', `Could not save profile image for '${user.name}': ${error}`); + }); } - - const filepath = interpolate(config.library.profile.image, user, null, { - // pass profile image as item to interpolate extension variable - url: image - }); - - fetchItem(image).then(stream => save(filepath, stream)).catch(error => { - console.log('\x1b[33m%s\x1b[0m', `Could not save profile image for '${user.name}': ${error}`); - }); } if(config.library.profile.description) {