note to self don't use statsync
This commit is contained in:
parent
28cbe48793
commit
28cf479e4b
@ -72,13 +72,13 @@ class UserEndpoint extends ApiEndpoint {
|
||||
const x = file.name.split('.');
|
||||
const fileName = `${user.id}.${x[x.length - 1]}`;
|
||||
const avatarsDir = path.resolve(this.server.serveFiles, 'avatars');
|
||||
if (!fs.statSync(avatarsDir))
|
||||
if (!fs.existsSync(avatarsDir))
|
||||
fs.mkdirSync(avatarsDir);
|
||||
|
||||
// Delete old avatar
|
||||
if (user.avatar) {
|
||||
const oldAvatar = path.join(avatarsDir, user.avatar);
|
||||
if (fs.statSync(oldAvatar))
|
||||
if (fs.existsSync(oldAvatar))
|
||||
fs.unlinkSync(oldAvatar);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user