Skip to content

Commit

Permalink
Retry if gallery image query for i.imgur.com fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbreitbart committed Mar 31, 2016
1 parent b811d7e commit 10584eb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fromURL.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ func (client *Client) GetInfoFromURL(url string) (*GenericInfo, int, error) {
}
id := url[start:end]
client.Log.Debugf("Detected imgur image ID %v. Was going down the i.imgur.com/ path.", id)
ii, status, err := client.GetGalleryImageInfo(id)
ret.GImage = ii
gii, status, err := client.GetGalleryImageInfo(id)
if status < 400 {
ret.GImage = gii
} else {
var ii *ImageInfo
ii, status, err = client.GetImageInfo(id)
ret.Image = ii
}
return &ret, status, err
}

Expand Down

0 comments on commit 10584eb

Please # to comment.