turn tagPosition off - test passes
This commit is contained in:
parent
eb71e1dd0c
commit
705b84b75b
@ -14,7 +14,7 @@ import Text.HTML.TagSoup
|
|||||||
sanitizeXSS :: String -> String
|
sanitizeXSS :: String -> String
|
||||||
sanitizeXSS = renderTagsOptions renderOptions {
|
sanitizeXSS = renderTagsOptions renderOptions {
|
||||||
optMinimize = \x -> x `elem` ["br","img"]
|
optMinimize = \x -> x `elem` ["br","img"]
|
||||||
} . safeTags . parseTagsOptions parseOptions { optTagPosition = True }
|
} . safeTags . parseTags -- Options parseOptions { optTagPosition = True }
|
||||||
where
|
where
|
||||||
safeTags :: [Tag String] -> [Tag String]
|
safeTags :: [Tag String] -> [Tag String]
|
||||||
safeTags [] = []
|
safeTags [] = []
|
||||||
|
|||||||
2
test.hs
2
test.hs
@ -3,5 +3,5 @@ import Text.HTML.SanitizeXSS
|
|||||||
main = do
|
main = do
|
||||||
let test = " <a href='unsafe://hack.com'>anchor</a> <img src='evil://evil.com' /> <unsafe></foo> <bar /> <br></br> "
|
let test = " <a href='unsafe://hack.com'>anchor</a> <img src='evil://evil.com' /> <unsafe></foo> <bar /> <br></br> "
|
||||||
let actual = (sanitizeXSS test)
|
let actual = (sanitizeXSS test)
|
||||||
let expected = " <a>anchor</a> <img /> <br /> "
|
let expected = " <a>anchor</a> <img /> <br /> "
|
||||||
putStrLn $ if actual == expected then "pass" else "failure parsing:" ++ (show test) ++ "\nexpected:" ++ (show expected) ++ "\nactual: " ++ (show actual)
|
putStrLn $ if actual == expected then "pass" else "failure parsing:" ++ (show test) ++ "\nexpected:" ++ (show expected) ++ "\nactual: " ++ (show actual)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user