diff --git a/src/Handler/Utils/Files.hs b/src/Handler/Utils/Files.hs index 91aeb8198..c058a3ffa 100644 --- a/src/Handler/Utils/Files.hs +++ b/src/Handler/Utils/Files.hs @@ -132,7 +132,7 @@ respondFileConditional representationLastModified cType FileReference{..} = do respRange = case byteRange of ByteRangeSpecification f Nothing -> ByteRangeResponseSpecification (min (pred iLength) f) (pred iLength) ByteRangeSpecification f (Just t) -> ByteRangeResponseSpecification (min (pred iLength) f) (min (pred iLength) t) - ByteRangeSuffixSpecification s -> ByteRangeResponseSpecification (iLength - (min (pred iLength) s)) (pred iLength) + ByteRangeSuffixSpecification s -> ByteRangeResponseSpecification (iLength - min (pred iLength) s) (pred iLength) in ( do chunkVar <- newEmptyTMVarIO minioAsync <- lift . allocateLinkedAsync $ @@ -160,7 +160,7 @@ respondFileConditional representationLastModified cType FileReference{..} = do let (byteFrom, byteTo) = case byteRange of ByteRangeSpecification f Nothing -> (min (pred iLength) f, pred iLength) ByteRangeSpecification f (Just t) -> (min (pred iLength) f, min (pred iLength) t) - ByteRangeSuffixSpecification s -> (iLength - (min (pred iLength) s), pred iLength) + ByteRangeSuffixSpecification s -> (iLength - min (pred iLength) s, pred iLength) relevantChunks = view _2 $ foldl' go (0, []) dbManifest'' where go :: (Natural, [(FileContentChunkReference, Natural, Natural)]) -> (FileContentChunkReference, Natural) diff --git a/src/Utils/HttpConditional.hs b/src/Utils/HttpConditional.hs index eb4c2b928..e295dbbe1 100644 --- a/src/Utils/HttpConditional.hs +++ b/src/Utils/HttpConditional.hs @@ -214,7 +214,7 @@ instance IsRangeUnit req resp => FromHttpApiData (RangeRequest req) where void . A.string $ rangeUnit (Proxy @req) (Proxy @resp) void $ A.char '=' t <- A.takeText - either (fail . unpack) return . fmap RangeRequest $ parseUrlPiece t + either (fail . unpack) (return . RangeRequest) $ parseUrlPiece t newtype RangeResponse resp = RangeResponse resp deriving (Generic, Typeable)