Skip to content

Commit

Permalink
Dont open relative articles such as Ask HN
Browse files Browse the repository at this point in the history
  • Loading branch information
piqoni committed Jun 3, 2024
1 parent c0496ac commit 3aad280
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os/exec"
"runtime"
"strconv"
"strings"

"github.com/gdamore/tcell/v2"
"github.com/gelembjuk/articletext"
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 3aad280

Please sign in to comment.