Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

fix(users) Fix bug file mime-type validate does not work #1272

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ exports.update = function (req, res) {
*/
exports.changeProfilePicture = function (req, res) {
var user = req.user;
var upload = multer(config.uploads.profileUpload).single('newProfilePicture');
var profileUploadFileFilter = require(path.resolve('./config/lib/multer')).profileUploadFileFilter;

// Filtering to upload only images
upload.fileFilter = profileUploadFileFilter;
var multerConfig = config.uploads.profileUpload;
multerConfig.fileFilter = require(path.resolve('./config/lib/multer')).profileUploadFileFilter; // Filtering to upload only images
var upload = multer(multerConfig).single('newProfilePicture');

if (user) {
upload(req, res, function (uploadError) {
Expand Down