Limit number of returned codepoints

This commit is contained in:
Paul Brinkmeier 2023-03-17 02:19:15 +01:00
parent fde68ee833
commit 57173d14dd

View File

@ -128,7 +128,14 @@ newtype CodepointsModel = CodepointsModel
}
mkCodepointsModel :: [(Word, Word)] -> CodepointsModel
mkCodepointsModel = CodepointsModel . map go . concatMap (uncurry enumFromTo)
mkCodepointsModel =
CodepointsModel
-- Limit number of returned codepoints. Otherwise it's
-- too easy to provoke massive response bodies with requests like
-- /codepoints/0-99999999
. take 100000
. map go
. concatMap (uncurry enumFromTo)
where
go codepoint = (codepoint, toChar codepoint)