1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-06-19 19:25:24 +00:00

🐛 Stop double requests - fixes #50

This commit is contained in:
makeworld 2020-07-26 11:31:13 -04:00
parent 481e2797f7
commit d32fc9159a
2 changed files with 13 additions and 7 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- You can't change link selection while the page is loading
- Only one request is made for each URL - `v1.3.0` accidentally made two requests each time (#50)
## [1.3.0] - 2020-07-10

View File

@ -255,18 +255,23 @@ func handleURL(t *tab, u string) (string, bool) {
return ret("", false)
}
// Make new request for downloading purposes
res, clientErr := client.Fetch(u)
if clientErr != nil && clientErr != client.ErrTofu {
Error("URL Fetch Error", err.Error())
return ret("", false)
}
if err == renderer.ErrTooLarge {
// Make new request for downloading purposes
res, clientErr := client.Fetch(u)
if clientErr != nil && clientErr != client.ErrTofu {
Error("URL Fetch Error", err.Error())
return ret("", false)
}
go dlChoice("That page is too large. What would you like to do?", u, res)
return ret("", false)
}
if err == renderer.ErrTimedOut {
// Make new request for downloading purposes
res, clientErr := client.Fetch(u)
if clientErr != nil && clientErr != client.ErrTofu {
Error("URL Fetch Error", err.Error())
return ret("", false)
}
go dlChoice("Loading that page timed out. What would you like to do?", u, res)
return ret("", false)
}