Skip to content

Commit

Permalink
Fixed rate limit usage for invalid album queries
Browse files Browse the repository at this point in the history
  • Loading branch information
jbreitbart committed Apr 13, 2020
1 parent 2fb3a80 commit c25ab65
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions album.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit c25ab65

Please # to comment.