mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +01:00
24 lines
801 B
Haskell
24 lines
801 B
Haskell
module Handler.StackageSdist where
|
|
|
|
import Import
|
|
import Data.BlobStore
|
|
|
|
getStackageSdistR :: PackageSetIdent -> PackageNameVersion -> Handler TypedContent
|
|
getStackageSdistR ident (PackageNameVersion name version) = do
|
|
msrc1 <- storeRead (CustomSdist ident name version)
|
|
msrc <-
|
|
case msrc1 of
|
|
Just src -> return $ Just src
|
|
Nothing -> storeRead $ HackageSdist name version
|
|
case msrc of
|
|
Nothing -> notFound
|
|
Just src -> do
|
|
addHeader "content-disposition" $ concat
|
|
[ "attachment; filename=\""
|
|
, toPathPiece name
|
|
, "-"
|
|
, toPathPiece version
|
|
, ".tar.gz"
|
|
]
|
|
respondSource "application/x-gzip" $ mapOutput (Chunk . toBuilder) src
|