More sanity checking on passed IDs
This commit is contained in:
parent
a33570e1d0
commit
ff698cff14
4 changed files with 22 additions and 2 deletions
|
@ -24,6 +24,7 @@ module.exports.match = function(url, type) {
|
|||
|
||||
module.exports.lookupId = function(id) {
|
||||
var deferred = Q.defer();
|
||||
|
||||
if (id.substr(0,2) == "al") {
|
||||
request.get(apiRoot + "/albums/" + id + "/images/default?size=medium&client_id=" + credentials.key).redirects(0).end(function(res) {
|
||||
var artwork = res.headers.location;
|
||||
|
@ -65,6 +66,10 @@ module.exports.lookupId = function(id) {
|
|||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
var error = new Error("Not Found");
|
||||
error.status = 404;
|
||||
deferred.reject(error);
|
||||
}
|
||||
return deferred.promise;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue