upload now purges old filename

This commit is contained in:
nek0 2014-12-03 23:30:13 +01:00
parent 485fe73fde
commit d6d79166f1

View file

@ -181,11 +181,14 @@ generateThumb path userId albumId = do
writeOnDrive :: FileInfo -> UserId -> AlbumId -> Handler FP.FilePath writeOnDrive :: FileInfo -> UserId -> AlbumId -> Handler FP.FilePath
writeOnDrive fil userId albumId = do writeOnDrive fil userId albumId = do
filen <- return $ fileName fil --filen <- return $ fileName fil
album <- runDB $ getJust albumId
filen <- return $ show $ (length $ albumContent album) + 1
ext <- return $ FP.takeExtension $ T.unpack $ fileName fil
path <- return $ "static" FP.</> "data" path <- return $ "static" FP.</> "data"
FP.</> (T.unpack $ extractKey userId) FP.</> (T.unpack $ extractKey userId)
FP.</> (T.unpack $ extractKey albumId) FP.</> (T.unpack $ extractKey albumId)
FP.</> (T.unpack filen) FP.</> filen ++ ext
liftIO $ fileMove fil path liftIO $ fileMove fil path
return path return path