mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
Enable go-critic linter and fix various issues detected
This commit is contained in:
parent
f6404290ba
commit
b1e73fafdf
34 changed files with 126 additions and 109 deletions
|
@ -190,17 +190,18 @@ func sanitizeAttributes(baseURL, tagName string, attributes []html.Attribute) ([
|
|||
}
|
||||
|
||||
if isExternalResourceAttribute(attribute.Key) {
|
||||
if tagName == "iframe" {
|
||||
switch {
|
||||
case tagName == "iframe":
|
||||
if !isValidIframeSource(baseURL, attribute.Val) {
|
||||
continue
|
||||
}
|
||||
value = rewriteIframeURL(attribute.Val)
|
||||
} else if tagName == "img" && attribute.Key == "src" && isValidDataAttribute(attribute.Val) {
|
||||
case tagName == "img" && attribute.Key == "src" && isValidDataAttribute(attribute.Val):
|
||||
value = attribute.Val
|
||||
} else if isAnchor("a", attribute) {
|
||||
case isAnchor("a", attribute):
|
||||
value = attribute.Val
|
||||
isAnchorLink = true
|
||||
} else {
|
||||
default:
|
||||
value, err = urllib.AbsoluteURL(baseURL, value)
|
||||
if err != nil {
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue