From 04ed79e587e6639340d8912ca4f982059b22b6bf Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 20 Mar 2015 14:48:19 -0400 Subject: [PATCH] fix profile image upload on subfolder install --- src/controllers/accounts.js | 4 ++-- src/user.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/accounts.js b/src/controllers/accounts.js index 8b966fbd26..51cc3daf82 100644 --- a/src/controllers/accounts.js +++ b/src/controllers/accounts.js @@ -356,7 +356,7 @@ accountsController.accountSettings = function(req, res, next) { }, userGroups: function(next) { groups.getUserGroups([userData.uid], next); - }, + }, languages: function(next) { languages.list(next); } @@ -434,7 +434,7 @@ accountsController.uploadPicture = function (req, res, next) { user.setUserFields(updateUid, {uploadedpicture: image.url, picture: image.url}); - res.json([{name: userPhoto.name, url: nconf.get('relative_path') + image.url}]); + res.json([{name: userPhoto.name, url: image.url.startsWith('http') ? image.url : nconf.get('relative_path') + image.url}]); } if (err) { diff --git a/src/user.js b/src/user.js index cb4492765a..2b9c411ab8 100644 --- a/src/user.js +++ b/src/user.js @@ -120,7 +120,7 @@ var async = require('async'), if (user.picture) { if (user.picture === user.uploadedpicture) { - user.picture = user.uploadedpicture = user.picture.indexOf('http') === -1 ? nconf.get('relative_path') + user.picture : user.picture; + user.picture = user.uploadedpicture = user.picture.startsWith('http') ? user.picture : nconf.get('relative_path') + user.picture; } else { user.picture = User.createGravatarURLFromEmail(user.email); }