mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 20:28:32 +01:00
This allows us to replace the Haddock-generate contents pages with our snapshot/package pages.
23 lines
795 B
Haskell
23 lines
795 B
Haskell
module Handler.HackageViewSdist where
|
|
|
|
import Import
|
|
import Data.Hackage
|
|
import Handler.StackageSdist (addDownload)
|
|
|
|
getHackageViewSdistR :: HackageView -> PackageNameVersion -> Handler TypedContent
|
|
getHackageViewSdistR viewName (PNVTarball name version) = do
|
|
addDownload Nothing (Just viewName) name version
|
|
msrc <- sourceHackageViewSdist viewName 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
|
|
getHackageViewSdistR _ _ = notFound
|