added back base_url
v1.18.x
barisusakli 10 years ago
parent 3a36ae5c13
commit ed72bacb1f

@ -118,6 +118,7 @@ function start() {
// Parse out the relative_url and other goodies from the configured URL // Parse out the relative_url and other goodies from the configured URL
var urlObject = url.parse(nconf.get('url')); var urlObject = url.parse(nconf.get('url'));
var relativePath = urlObject.pathname !== '/' ? urlObject.pathname : ''; var relativePath = urlObject.pathname !== '/' ? urlObject.pathname : '';
nconf.set('base_url', urlObject.protocol + '//' + urlObject.host);
nconf.set('use_port', !!urlObject.port); nconf.set('use_port', !!urlObject.port);
nconf.set('relative_path', relativePath); nconf.set('relative_path', relativePath);
nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || 4567); nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || 4567);

@ -39,14 +39,9 @@ var async = require('async'),
// Fix relative paths in topic data // Fix relative paths in topic data
data.topics.topics = data.topics.topics.map(function(topicObj) { data.topics.topics = data.topics.topics.map(function(topicObj) {
if (topicObj.hasOwnProperty('teaser') && topicObj.teaser !== undefined) { var user = topicObj.hasOwnProperty('teaser') && topicObj.teaser !== undefined ? topicObj.teaser.user : topicObj.user;
if (utils.isRelativeUrl(topicObj.teaser.user.picture)) { if (user && user.picture && utils.isRelativeUrl(user.picture)) {
topicObj.teaser.user.picture = nconf.get('url') + topicObj.teaser.user.picture; user.picture = nconf.get('base_url') + user.picture;
}
} else {
if (utils.isRelativeUrl(topicObj.user.picture)) {
topicObj.user.picture = nconf.get('url') + topicObj.user.picture;
}
} }
return topicObj; return topicObj;

Loading…
Cancel
Save