From a71a38926b315d663a326b3ab40b2116511c99a5 Mon Sep 17 00:00:00 2001 From: makeworld Date: Fri, 15 Apr 2022 11:33:32 -0400 Subject: [PATCH] Opening a relative link in a new tab on an about: page doesn't break Fixes #306 --- CHANGELOG.md | 1 + display/display.go | 8 ++++++-- display/newtab.go | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e745a7..2d8bc92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) - 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) +- `new:7` on new tab page fails to open link (#306) ## [1.9.2] - 2021-12-10 diff --git a/display/display.go b/display/display.go index d89cbc9..c7cd6f6 100644 --- a/display/display.go +++ b/display/display.go @@ -202,14 +202,18 @@ func Init(version, commit, builtBy string) { // Open new tab and load link oldTab := tab // Resolve and follow link manually - prevParsed, _ := url.Parse(tabs[oldTab].page.URL) nextParsed, err := url.Parse(tabs[oldTab].page.Links[i-1]) if err != nil { Error("URL Error", "link URL could not be parsed") reset() 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 } } else { diff --git a/display/newtab.go b/display/newtab.go index c85d027..87b538d 100644 --- a/display/newtab.go +++ b/display/newtab.go @@ -29,7 +29,7 @@ Happy browsing! => https://github.com/makeworld-the-better-one/amfora/wiki Amfora Wiki [GitHub] => 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.