When parsing ID URIs in AP JSON, make sure their authority part is non-empty
This commit is contained in:
parent
c2c4e24497
commit
d4c7fa5809
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue