hiteshchoudhary / chai-backend

A video series on chai aur code youtube channel
4.69k stars 697 forks source link

Fix File Cleanup Bug During User Registration in registerUser Function #128

Open Lonka-Pardhu opened 2 months ago

Lonka-Pardhu commented 2 months ago

This pull request fixes a bug in the registerUser function where temporary files uploaded via multer were not being deleted if a user already exists, leading to orphaned files on the server.

The fix involves adding logic to delete these files before throwing an error when a user with the same email or username is found