mirror of
https://github.com/velour/catbase.git
synced 2025-04-04 04:01:42 +00:00
meme: handle bad URL errors
This commit is contained in:
parent
12ca34006f
commit
828c19d7eb
@ -114,7 +114,12 @@ func (p *MemePlugin) all(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
realURL, err := url.Parse(u)
|
||||
if err != nil || realURL.Scheme == "" {
|
||||
realURL, _ = url.Parse("https://imgflip.com/s/meme/" + u)
|
||||
realURL, err = url.Parse("https://imgflip.com/s/meme/" + u)
|
||||
if err != nil {
|
||||
values = append(values, webResp{n, "404.png"})
|
||||
log.Error().Err(err).Msgf("invalid URL")
|
||||
continue
|
||||
}
|
||||
}
|
||||
values = append(values, webResp{n, realURL.String()})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user