@@ -342,11 +342,13 @@ data StaticSettings = StaticSettings
342342 }
343343
344344defaultMkRedirect :: Pieces -> ByteString -> S8.ByteString
345−defaultMkRedirect pieces newPath =
346− let relDir = TE.encodeUtf8 (relativeDirFromPieces pieces) in
347− S8.append relDir (if (S8.last relDir) == '/' && (S8.head newPath) == '/'
348− then S8.tail newPath
349− else newPath)
345+defaultMkRedirect pieces newPath
346+ | S8.null newPath || S8.null relDir ||
347+ S8.last relDir /= '/' || S8.head newPath /= '/' =
348+ relDir `S8.append` newPath
349+ | otherwise = relDir `S8.append` S8.tail newPath
350+ where
351+ relDir = TE.encodeUtf8 (relativeDirFromPieces pieces)
350352
351353defaultStaticSettings :: CacheSettings -> StaticSettings
352354defaultStaticSettings isStaticFile = StaticSettings { ssFolder = fileSystemLookup "static"