fix bug in file naming.
fixes bug that occurs when uploading files to an album, where media have been previously deleted.
This commit is contained in:
parent
27bfdfbd7c
commit
96d2483b06
1 changed files with 1 additions and 1 deletions
|
@ -184,7 +184,7 @@ 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
|
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 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
|
let path = "static" FP.</> "data" FP.</> T.unpack (extractKey userId) FP.</> T.unpack (extractKey albumId) FP.</> filen ++ ext
|
||||||
dde <- liftIO $ doesDirectoryExist $ FP.dropFileName path
|
dde <- liftIO $ doesDirectoryExist $ FP.dropFileName path
|
||||||
|
|
Loading…
Reference in a new issue