mirror of
https://github.com/miniflux/v2.git
synced 2025-08-11 17:51:01 +00:00
Allow only absolute URLs in comments URL
Some feeds are using invalid URLs (random text).
This commit is contained in:
parent
8cebd985a2
commit
bf632fad2e
6 changed files with 105 additions and 2 deletions
|
@ -11,6 +11,15 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// IsAbsoluteURL returns true if the link is absolute.
|
||||
func IsAbsoluteURL(link string) bool {
|
||||
u, err := url.Parse(link)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return u.IsAbs()
|
||||
}
|
||||
|
||||
// AbsoluteURL converts the input URL as absolute URL if necessary.
|
||||
func AbsoluteURL(baseURL, input string) (string, error) {
|
||||
if strings.HasPrefix(input, "//") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue