More sanity checking on passed IDs
This commit is contained in:
parent
a33570e1d0
commit
ff698cff14
4 changed files with 22 additions and 2 deletions
lib/services
|
@ -25,6 +25,12 @@ module.exports.lookupId = function(id) {
|
|||
method: 'getObjectFromShortCode',
|
||||
short_code: id,
|
||||
}, function(err, results) {
|
||||
if (err || !JSON.parse(results).result) {
|
||||
var error = new Error("Not Found");
|
||||
error.status = 404;
|
||||
deferred.reject(error);
|
||||
return;
|
||||
}
|
||||
var result = JSON.parse(results).result;
|
||||
var parsed = parse(result.shortUrl)
|
||||
var id = parsed.path.replace("/x/", "").replace("/", "");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue