Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix broken paths to sub collections and docs (the url creating is get…

…ting silly)
  • Loading branch information...
commit f0265a9637d352f27a810875e2df318c9f9185cc 1 parent 8bfc205
@evdb evdb authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/apps/api/api_v1.js
View
8 lib/apps/api/api_v1.js
@@ -254,7 +254,7 @@ function create_api_endpoint ( options ) {
result[key].forEach( function (item) {
if (_.isObject(item)) {
item.meta = {
- api_url: current_absolute_url(req) + '/' + key + '/' + item._id,
+ api_url: base_url(req) + '/api' + req.app.set('basepath') + '/' + doc.id + '/' + key + '/' + item._id,
};
}
});
@@ -276,10 +276,10 @@ function create_api_endpoint ( options ) {
var doc = res.local('doc');
var sub_name = res.local('sub_name');
- var results = _.map( doc[sub_name], function (doc) {
- var result = doc.toObject();
+ var results = _.map( doc[sub_name], function (sub_doc) {
+ var result = sub_doc.toObject();
result.meta = {
- api_url: current_absolute_url(req) + '/' + doc._id,
+ api_url: base_url(req) + '/api' + req.app.set('basepath') + '/' + doc.id + '/' + sub_name + '/' + sub_doc.id,
};
return result;
});
Please sign in to comment.
Something went wrong with that request. Please try again.