diff options
Diffstat (limited to '')
-rw-r--r-- | lib/Paths.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Paths.hs b/lib/Paths.hs index f72874f..d2861eb 100644 --- a/lib/Paths.hs +++ b/lib/Paths.hs @@ -20,12 +20,18 @@ data RelPath = Path Int Text (Maybe Text) -data PathResult = OkRelPath RelPath | AbsolutePath | NotAPath | UnderscoreMapLink | AtMapLink +data PathResult = OkRelPath RelPath + | AbsolutePath + | NotAPath + | UnderscoreMapLink + | AtMapLink + | PathVarsDisallowed -- | horrible regex parsing for filepaths that is hopefully kinda safe parsePath :: Text -> PathResult parsePath text = - if | rest =~ ("^([^/]*[^\\./]/)*[^/]*[^\\./]$" :: Text) -> OkRelPath (Path up path fragment) + if | text =~ ("{{{.*}}}" :: Text) -> PathVarsDisallowed + | rest =~ ("^([^/]*[^\\./]/)*[^/]*[^\\./]$" :: Text) -> OkRelPath (Path up path fragment) | "/_/" `isPrefixOf` text -> UnderscoreMapLink | "/@/" `isPrefixOf` text -> AtMapLink | "/" `isPrefixOf` text -> AbsolutePath |