From c25ab65fb72173485be995c3340fa829a71e299b Mon Sep 17 00:00:00 2001 From: Jens Breitbart Date: Mon, 13 Apr 2020 12:28:09 +0200 Subject: [PATCH] Fixed rate limit usage for invalid album queries --- album.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/album.go b/album.go index 3788af8..c2d815f 100644 --- a/album.go +++ b/album.go @@ -66,17 +66,18 @@ func (client *Client) GetAlbumInfo(id string) (*AlbumInfo, int, error) { if err != nil { return nil, -1, errors.New("Problem getting URL for album info ID " + id + " - " + err.Error()) } - // client.Log.Debugf("%v\n", body) + //client.Log.Debugf("%v\n", body) dec := json.NewDecoder(strings.NewReader(body)) var alb albumInfoDataWrapper if err := dec.Decode(&alb); err != nil { return nil, -1, errors.New("Problem decoding json for albumID " + id + " - " + err.Error()) } - alb.Ai.Limit = rl if !alb.Success { return nil, alb.Status, errors.New("Request to imgur failed for albumID " + id + " - " + strconv.Itoa(alb.Status)) } + + alb.Ai.Limit = rl return alb.Ai, alb.Status, nil }