~singpolyma/cheogram

c16e49a3bd6ac7dc8773910a46ffc4fe85d9d89c — Stephen Paul Weber 21 days ago ae381d5
Preserve file extesion through cacheOOB

Some users have MIME-blind tooling that really likes file extensions like the
olden days.  Doesn't hurt us to support that in some cases.  So, if the original
URL had an extension (something at the end ofter a . 4 chars or less) we append
it to the new URL.  Make sure your server is set up to rewrite these away!
1 files changed, 5 insertions(+), 1 deletions(-)

M Main.hs
M Main.hs => Main.hs +5 -1
@@ 1060,7 1060,11 @@ cacheOneOOB pushStatsd jingleStore jingleStoreURL oob
				return (Nothing, oob)
			Right path ->
				pushStatsd [StatsD.stat ["cache", "oob", "success"] 1 "c" Nothing] >>
				let url' = jingleStoreURL ++ (T.takeWhileEnd (/='/') $ fromString path) in
				let
					ext = T.takeWhileEnd (\c -> c /= '.' && c /= '/') url
					extSuffix = if T.length ext <= 4 then s"." ++ ext else mempty
					url' = jingleStoreURL ++ (T.takeWhileEnd (/='/') $ fromString path) ++ extSuffix
				in
				return (
					Just (url, url'),
					oob {