@@ -98,9 +98,17 @@ renderTags' = TS.renderTagsOptions TS.renderOptions
9898-- Result:
9999--
100100-- > "/foo/bar.html"
101+--
102+-- This also sanitizes the URL, e.g. converting spaces into '%20'
101103toUrl :: FilePath -> String
102−toUrl ('/' : xs) = '/' : xs
103−toUrl url = '/' : url
104+toUrl url = case url of
105+ ('/' : xs) -> '/' : sanitize xs
106+ xs -> '/' : sanitize xs
107+ where
108+ -- This probably needs to be a separate function
109+ sanitize = concatMap $ \c -> case c of
110+ ' ' -> "%20"
111+ _ -> [c]
104112
105113
106114--------------------------------------------------------------------------------