changed storage location of files
This commit is contained in:
parent
07e9f9a213
commit
6d7257156f
4 changed files with 4 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,4 +12,4 @@ yesod-devel/
|
||||||
cabal.sandbox.config
|
cabal.sandbox.config
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.swp
|
*.swp
|
||||||
data*
|
static/data*
|
||||||
|
|
|
@ -14,7 +14,7 @@ getActivateR token = do
|
||||||
redirect $ HomeR
|
redirect $ HomeR
|
||||||
Just x -> do
|
Just x -> do
|
||||||
userId <- runDB $ insert $ tokenUser (entityVal x)
|
userId <- runDB $ insert $ tokenUser (entityVal x)
|
||||||
liftIO $ createDirectoryIfMissing True $ "data" </> (unpack $ extractKey userId)
|
liftIO $ createDirectoryIfMissing True $ "static" </> "data" </> (unpack $ extractKey userId)
|
||||||
runDB $ delete (entityKey x)
|
runDB $ delete (entityKey x)
|
||||||
setMessage $ "User activated"
|
setMessage $ "User activated"
|
||||||
redirect $ HomeR
|
redirect $ HomeR
|
||||||
|
|
|
@ -28,7 +28,7 @@ postNewAlbumR = do
|
||||||
case result of
|
case result of
|
||||||
FormSuccess album -> do
|
FormSuccess album -> do
|
||||||
albumId <- runDB $ insert album
|
albumId <- runDB $ insert album
|
||||||
liftIO $ createDirectory $ "data" </> (unpack $ extractKey userId) </> (unpack $ extractKey albumId)
|
liftIO $ createDirectory $ "static" </> "data" </> (unpack $ extractKey userId) </> (unpack $ extractKey albumId)
|
||||||
setMessage $ "Album successfully created"
|
setMessage $ "Album successfully created"
|
||||||
redirect $ ProfileR userId
|
redirect $ ProfileR userId
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ postUploadR = do
|
||||||
writeOnDrive :: FileInfo -> UserId -> AlbumId -> Handler FilePath
|
writeOnDrive :: FileInfo -> UserId -> AlbumId -> Handler FilePath
|
||||||
writeOnDrive file userId albumId = do
|
writeOnDrive file userId albumId = do
|
||||||
filename <- return $ fileName file
|
filename <- return $ fileName file
|
||||||
path <- return $ "data"
|
path <- return $ "static" </> "data"
|
||||||
</> (unpack $ extractKey userId)
|
</> (unpack $ extractKey userId)
|
||||||
</> (unpack $ extractKey albumId)
|
</> (unpack $ extractKey albumId)
|
||||||
</> (unpack filename)
|
</> (unpack filename)
|
||||||
|
|
Loading…
Reference in a new issue