Skip to content

Commit

Permalink
fix(open): don't open if there's no HtmlUrl (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
nobe4 authored Oct 3, 2024
1 parent de962fa commit b8a2ea5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/actions/open/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Package open implements an [actions.Runner] that opens a notification in the bro
package open

import (
"errors"
"fmt"
"io"
"log/slog"
Expand All @@ -23,6 +24,10 @@ func (a *Runner) Run(n *notifications.Notification, _ []string, w io.Writer) err

browser := browser.New("", w, w)

if n.Subject.HtmlUrl == "" {
return errors.New("no URL to open")
}

err := browser.Browse(n.Subject.HtmlUrl)
fmt.Fprint(w, colors.Blue("OPEN ")+n.Subject.URL)

Expand Down

0 comments on commit b8a2ea5

Please sign in to comment.