fix profile image upload on subfolder install

v1.18.x
barisusakli 10 years ago
parent c8e0eab34e
commit 04ed79e587

@ -356,7 +356,7 @@ accountsController.accountSettings = function(req, res, next) {
}, },
userGroups: function(next) { userGroups: function(next) {
groups.getUserGroups([userData.uid], next); groups.getUserGroups([userData.uid], next);
}, },
languages: function(next) { languages: function(next) {
languages.list(next); languages.list(next);
} }
@ -434,7 +434,7 @@ accountsController.uploadPicture = function (req, res, next) {
user.setUserFields(updateUid, {uploadedpicture: image.url, picture: image.url}); 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) { if (err) {

@ -120,7 +120,7 @@ var async = require('async'),
if (user.picture) { if (user.picture) {
if (user.picture === user.uploadedpicture) { 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 { } else {
user.picture = User.createGravatarURLFromEmail(user.email); user.picture = User.createGravatarURLFromEmail(user.email);
} }

Loading…
Cancel
Save