mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Inline a function and fix a bug in it
The `isAnchor` function's first parameter was always `a`, instead of being passed `tagName`. As this function is a single line and was only called in a single place, it can be inlined.
This commit is contained in:
parent
2314500515
commit
902ca63c45
1 changed files with 1 additions and 5 deletions
|
@ -195,7 +195,7 @@ func sanitizeAttributes(baseURL, tagName string, attributes []html.Attribute) ([
|
|||
value = rewriteIframeURL(attribute.Val)
|
||||
case tagName == "img" && attribute.Key == "src" && isValidDataAttribute(attribute.Val):
|
||||
value = attribute.Val
|
||||
case isAnchor("a", attribute):
|
||||
case tagName == "a" && attribute.Key == "href" && strings.HasPrefix(attribute.Val, "#"):
|
||||
value = attribute.Val
|
||||
isAnchorLink = true
|
||||
default:
|
||||
|
@ -443,10 +443,6 @@ func isValidDataAttribute(value string) bool {
|
|||
})
|
||||
}
|
||||
|
||||
func isAnchor(tagName string, attribute html.Attribute) bool {
|
||||
return tagName == "a" && attribute.Key == "href" && strings.HasPrefix(attribute.Val, "#")
|
||||
}
|
||||
|
||||
func isPositiveInteger(value string) bool {
|
||||
if number, err := strconv.Atoi(value); err == nil {
|
||||
return number > 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue