From d4c7fa58095466548456c0bd80aac79c4c04f610 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Tue, 5 Feb 2019 12:54:55 +0000 Subject: [PATCH] When parsing ID URIs in AP JSON, make sure their authority part is non-empty --- src/Data/Aeson/Local.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Data/Aeson/Local.hs b/src/Data/Aeson/Local.hs index 1428e05..f3c8e17 100644 --- a/src/Data/Aeson/Local.hs +++ b/src/Data/Aeson/Local.hs @@ -29,6 +29,7 @@ import Prelude import Control.Applicative ((<|>)) import Data.Aeson import Data.Aeson.Types (Parser) +import Data.Maybe (isJust) import Data.Text (Text) import Network.URI @@ -61,7 +62,9 @@ parseHttpsURI t = Nothing -> fail "Invalid absolute URI" Just u -> if uriScheme u == "https:" - then return u + then if isJust $ uriAuthority u + then return u + else fail "URI has empty authority" else fail "URI scheme isn't https" renderURI :: URI -> String