Opening a relative link in a new tab on an about: page doesn't break

Fixes #306
This commit is contained in:
makeworld 2022-04-15 11:33:32 -04:00
parent 00d90cbd7a
commit a71a38926b
3 changed files with 8 additions and 3 deletions

View File

@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Modal can't be closed when opening non-gemini text URLs from the commandline (#283, #284) - Modal can't be closed when opening non-gemini text URLs from the commandline (#283, #284)
- External programs started by Amfora remain as zombie processes (#219) - External programs started by Amfora remain as zombie processes (#219)
- Prevent link lines (and other types) from being wider than the `max_width` setting (#280) - Prevent link lines (and other types) from being wider than the `max_width` setting (#280)
- `new:7` on new tab page fails to open link (#306)
## [1.9.2] - 2021-12-10 ## [1.9.2] - 2021-12-10

View File

@ -202,14 +202,18 @@ func Init(version, commit, builtBy string) {
// Open new tab and load link // Open new tab and load link
oldTab := tab oldTab := tab
// Resolve and follow link manually // Resolve and follow link manually
prevParsed, _ := url.Parse(tabs[oldTab].page.URL)
nextParsed, err := url.Parse(tabs[oldTab].page.Links[i-1]) nextParsed, err := url.Parse(tabs[oldTab].page.Links[i-1])
if err != nil { if err != nil {
Error("URL Error", "link URL could not be parsed") Error("URL Error", "link URL could not be parsed")
reset() reset()
return return
} }
NewTabWithURL(prevParsed.ResolveReference(nextParsed).String()) if tabs[oldTab].hasContent() && !tabs[oldTab].isAnAboutPage() {
prevParsed, _ := url.Parse(tabs[oldTab].page.URL)
NewTabWithURL(prevParsed.ResolveReference(nextParsed).String())
} else {
NewTabWithURL(nextParsed.String())
}
return return
} }
} else { } else {

View File

@ -29,7 +29,7 @@ Happy browsing!
=> https://github.com/makeworld-the-better-one/amfora/wiki Amfora Wiki [GitHub] => https://github.com/makeworld-the-better-one/amfora/wiki Amfora Wiki [GitHub]
=> gemini://makeworld.space/amfora-wiki/ Amfora Wiki [On Gemini!] => gemini://makeworld.space/amfora-wiki/ Amfora Wiki [On Gemini!]
=> //gemini.circumlunar.space Project Gemini => gemini://gemini.circumlunar.space Project Gemini
` `
// Read the new tab content from a file if it exists or fallback to a default page. // Read the new tab content from a file if it exists or fallback to a default page.