Ignore mailto links

main
Brian Picciano 5 months ago
parent 1c91c0368c
commit b6c20e57f9
  1. 11
      client.go

@ -75,6 +75,9 @@ type client struct {
// Supported URL schemas:
// - gemini
// - http/https
//
// Some schemas automatically return success:
// - mailto
func NewClient(opts *ClientOpts) Client {
return &client{*opts.withDefaults()}
}
@ -240,6 +243,12 @@ func (c *client) getHTTP(
}
}
func (c *client) noOpGet() (
string, io.ReadCloser, error,
) {
return "", emptyReadCloser(), nil
}
func (c *client) get(
ctx context.Context, url URL, redirectDepth int,
) (
@ -252,6 +261,8 @@ func (c *client) get(
return c.getGemini(ctx, url, redirectDepth)
case "http", "https":
return c.getHTTP(ctx, url, redirectDepth)
case "mailto":
return c.noOpGet()
default:
return "", nil, fmt.Errorf("unsupported scheme %q", scheme)
}

Loading…
Cancel
Save