From 3aad2800ec1de749b5e6c84baa575f141f88bad4 Mon Sep 17 00:00:00 2001 From: Edi Piqoni Date: Mon, 3 Jun 2024 22:59:30 +0200 Subject: [PATCH] Dont open relative articles such as Ask HN --- ui.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui.go b/ui.go index f58ef27..97192e0 100644 --- a/ui.go +++ b/ui.go @@ -7,6 +7,7 @@ import ( "os/exec" "runtime" "strconv" + "strings" "github.com/gdamore/tcell/v2" "github.com/gelembjuk/articletext" @@ -115,6 +116,9 @@ func openComments(app *tview.Application, commentsLink string, pages *tview.Page } func openArticle(app *tview.Application, articleLink string, pages *tview.Pages) { + if !strings.HasPrefix(articleLink, "http") { + return // avoid trying to open relative pages like item?id=1234 like Ask HN + } articleText := getArticleTextFromLink(articleLink) displayArticle(app, pages, articleText) }