diff --git a/Text/HTML/SanitizeXSS.hs b/Text/HTML/SanitizeXSS.hs
index a94aa5f..291167f 100644
--- a/Text/HTML/SanitizeXSS.hs
+++ b/Text/HTML/SanitizeXSS.hs
@@ -76,7 +76,8 @@ safeAttribute (name, value) = name `member` sanitaryAttributes &&
sanitaryURI :: String -> Bool
sanitaryURI u =
case parseURIReference (escapeURI u) of
- Just p -> (init (map toLower $ uriScheme p)) `member` safeURISchemes
+ Just p -> (null (uriScheme p)) ||
+ ((map toLower $ init $ uriScheme p) `member` safeURISchemes)
Nothing -> False
diff --git a/test.hs b/test.hs
index 6ba0774..d94f3bc 100644
--- a/test.hs
+++ b/test.hs
@@ -9,3 +9,5 @@ test actual expected = do
main = do
test (sanitizeBalance testHTML) " safeanchor
Unbalanced
"
test (sanitize testHTML) " safeanchor
Unbalanced
"
+ let testRelativeURI = "bar"
+ test (sanitize testRelativeURI) testRelativeURI
diff --git a/xss-sanitize.cabal b/xss-sanitize.cabal
index 80c75f2..eefb495 100644
--- a/xss-sanitize.cabal
+++ b/xss-sanitize.cabal
@@ -1,5 +1,5 @@
name: xss-sanitize
-version: 0.2.3
+version: 0.2.4
license: BSD3
license-file: LICENSE
author: Greg Weber