mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 20:28:32 +01:00
19 lines
630 B
Haskell
19 lines
630 B
Haskell
module Handler.StackageIndex where
|
|
|
|
import Import
|
|
import Data.BlobStore
|
|
import Data.Slug (SnapSlug)
|
|
|
|
getStackageIndexR :: SnapSlug -> Handler TypedContent
|
|
getStackageIndexR slug = do
|
|
Entity _ stackage <- runDB $ getBy404 $ UniqueSnapshot slug
|
|
let ident = stackageIdent stackage
|
|
msrc <- storeRead $ CabalIndex ident
|
|
case msrc of
|
|
Nothing -> notFound
|
|
Just src -> do
|
|
setEtag $ toPathPiece ident
|
|
addHeader "content-disposition" "attachment; filename=\"00-index.tar.gz\""
|
|
neverExpires
|
|
respondSource "application/x-gzip" $ mapOutput (Chunk . toBuilder) src
|