From 96d2483b06436f9f7f7e33f99b9b2428af047e90 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 19 Nov 2016 10:44:47 +0100 Subject: [PATCH] fix bug in file naming. fixes bug that occurs when uploading files to an album, where media have been previously deleted. --- Handler/Upload.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Handler/Upload.hs b/Handler/Upload.hs index 369c0b3..24ded49 100755 --- a/Handler/Upload.hs +++ b/Handler/Upload.hs @@ -184,7 +184,7 @@ writeOnDrive :: FileInfo -> UserId -> AlbumId -> Handler FP.FilePath writeOnDrive fil userId albumId = do --filen <- return $ fileName fil album <- runDB $ getJust albumId - let filen = show $ length (albumContent album) + 1 + let filen = show $ (read $ show $ maximum $ albumContent album :: Int) + 1 let ext = FP.takeExtension $ T.unpack $ fileName fil let path = "static" FP. "data" FP. T.unpack (extractKey userId) FP. T.unpack (extractKey albumId) FP. filen ++ ext dde <- liftIO $ doesDirectoryExist $ FP.dropFileName path