Skip to content
Snippets Groups Projects
Commit 4c84f7db authored by stuebinm's avatar stuebinm
Browse files

urlencode dereferrer links

parent 4953496e
Branches
No related tags found
No related merge requests found
Pipeline #12339 passed
...@@ -24,7 +24,7 @@ import GHC.Generics (Generic) ...@@ -24,7 +24,7 @@ import GHC.Generics (Generic)
import GHC.TypeLits (KnownSymbol, symbolVal) import GHC.TypeLits (KnownSymbol, symbolVal)
import Text.Regex.TDFA ((=~)) import Text.Regex.TDFA ((=~))
import Witherable (mapMaybe) import Witherable (mapMaybe)
import Network.URI.Encode as URI
data Substitution = data Substitution =
Prefixed { prefix :: Text, blocked :: [Text], allowed :: [Text], scope :: [String] } Prefixed { prefix :: Text, blocked :: [Text], allowed :: [Text], scope :: [String] }
...@@ -98,7 +98,7 @@ applySubsts s substs uri = do ...@@ -98,7 +98,7 @@ applySubsts s substs uri = do
Prefixed {..} Prefixed {..}
| domain `elem` blocked -> Left IsBlocked | domain `elem` blocked -> Left IsBlocked
| domain `elem` allowed -> Right uri | domain `elem` allowed -> Right uri
| otherwise -> Right (prefix <> domain <> rest) | otherwise -> Right (prefix <> URI.encodeText uri)
Allowed _ domains -> if domain `elem` domains Allowed _ domains -> if domain `elem` domains
then Right uri then Right uri
else Left (DomainIsBlocked domains) else Left (DomainIsBlocked domains)
...@@ -56,7 +56,8 @@ library ...@@ -56,7 +56,8 @@ library
extra, extra,
witherable, witherable,
dotgen, dotgen,
text-metrics text-metrics,
uri-encode
-- TODO: move more stuff into lib, these dependencies are silly -- TODO: move more stuff into lib, these dependencies are silly
executable walint executable walint
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment