1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-28 11:44:51 +09:00

When parsing ID URIs in AP JSON, make sure their authority part is non-empty

This commit is contained in:
fr33domlover 2019-02-05 12:54:55 +00:00
parent c2c4e24497
commit d4c7fa5809

View file

@ -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