More sanity checking on passed IDs
This commit is contained in:
parent
a33570e1d0
commit
ff698cff14
4 changed files with 22 additions and 2 deletions
|
@ -18,6 +18,12 @@ module.exports.lookupId = function(id, type) {
|
|||
|
||||
request.get(apiRoot + path, function(res) {
|
||||
var result = res.body;
|
||||
if (res.body.error) {
|
||||
var error = new Error("Not Found");
|
||||
error.status = 404;
|
||||
deferred.reject(error);
|
||||
return;
|
||||
}
|
||||
var cover = result.cover || result.album.cover;
|
||||
request.get(cover).redirects(0).end(function(res) {
|
||||
var artwork = res.headers.location.replace("120x120", "200x200");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue