Skip to content

Commit

Permalink
Support for Snap 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Bowl committed Aug 9, 2016
1 parent 3c95d86 commit eea9fcc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion digestive-functors-snap/digestive-functors-snap.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Library
base >= 4 && < 5,
containers >= 0.3 && < 0.6,
digestive-functors >= 0.8 && < 0.9,
snap-core >= 0.7 && < 0.10,
snap-core >= 1.0,
text >= 0.11 && < 1.3,
directory >= 1.0 && < 1.4,
filepath >= 1.0 && < 1.5,
Expand Down
8 changes: 4 additions & 4 deletions digestive-functors-snap/src/Text/Digestive/Snap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ snapFiles config = do
temporaryDirectory config

-- Actually do the work...
Snap.handleFileUploads tmpDir (uploadPolicy config) (partPolicy config) $
fmap catMaybes . mapM (storeFile tmpDir)
fmap catMaybes $ Snap.handleFileUploads tmpDir (uploadPolicy config) (partPolicy config) $
storeFile tmpDir
where
storeFile _ (_, Left _) = return Nothing
storeFile tmp (partinfo, Right path) = do
storeFile _ _ (Left _) = return Nothing
storeFile tmp partinfo (Right path) = do
let newPath = tmp </> "_" ++ takeFileName path ++
maybe "" B.unpack (Snap.partFileName partinfo)
liftIO $ copyFile path newPath
Expand Down

0 comments on commit eea9fcc

Please sign in to comment.