mirror of
https://github.com/makew0rld/amfora.git
synced 2025-02-02 15:07:34 -05:00
Auto redirect if the new URL just adds a trailing slash (#271)
This commit is contained in:
parent
6e17b57837
commit
92fd9ed0bc
@ -380,9 +380,10 @@ func handleURL(t *tab, u string, numRedirects int) (string, bool) {
|
||||
return ret("", false)
|
||||
}
|
||||
redir := parsed.ResolveReference(parsedMeta).String()
|
||||
justAddsSlash := (redir == u+"/")
|
||||
// Prompt before redirecting to non-Gemini protocol
|
||||
redirect := false
|
||||
if !strings.HasPrefix(redir, "gemini") {
|
||||
if !justAddsSlash && !strings.HasPrefix(redir, "gemini") {
|
||||
if YesNo("Follow redirect to non-Gemini URL?\n" + redir) {
|
||||
redirect = true
|
||||
} else {
|
||||
@ -390,7 +391,7 @@ func handleURL(t *tab, u string, numRedirects int) (string, bool) {
|
||||
}
|
||||
}
|
||||
// Prompt before redirecting
|
||||
autoRedirect := viper.GetBool("a-general.auto_redirect")
|
||||
autoRedirect := justAddsSlash || viper.GetBool("a-general.auto_redirect")
|
||||
if redirect || (autoRedirect && numRedirects < 5) || YesNo("Follow redirect?\n"+redir) {
|
||||
if res.Status == gemini.StatusRedirectPermanent {
|
||||
go cache.AddRedir(u, redir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user