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

urlencode dereferrer links

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