mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
manually set content length
This commit is contained in:
@@ -24,6 +24,7 @@ import Lib.Registry
|
||||
import Lib.Semver
|
||||
import Lib.Types.Semver
|
||||
import System.FilePath ((<.>))
|
||||
import System.Posix.Files (fileSize, getFileStatus)
|
||||
|
||||
pureLog :: Show a => a -> Handler a
|
||||
pureLog = liftA2 (*>) ($logInfo . show) pure
|
||||
@@ -58,7 +59,10 @@ getApp rootDir ext = do
|
||||
Just (RegisteredAppVersion (_, filePath)) -> do
|
||||
exists <- liftIO $ doesFileExist filePath
|
||||
if exists
|
||||
then respondSource typePlain $ CB.sourceFile filePath .| awaitForever sendChunkBS
|
||||
then do
|
||||
sz <- liftIO $ fileSize <$> getFileStatus filePath
|
||||
addHeader "Content-Length" (show sz)
|
||||
respondSource typePlain $ CB.sourceFile filePath .| awaitForever sendChunkBS
|
||||
else notFound
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user