]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Resource/Object.hs
dropped the concept of page file name
[Rakka.git] / Rakka / Resource / Object.hs
index 00ebc28e140a622e9d7560e66fb52afc7810adfa..b46a86a30a330bbdcdbb412f09def05d66c50d86 100644 (file)
@@ -4,7 +4,6 @@ module Rakka.Resource.Object
     )
     where
 
-import           Data.ByteString.Char8 as C8
 import           Data.Maybe
 import           Network.HTTP.Lucu
 import           Network.HTTP.Lucu.Utils
@@ -34,14 +33,11 @@ handleGet :: Environment -> PageName -> Resource ()
 handleGet env name
     = do pageM <- getPage (envStorage env) name Nothing
          case pageM of
-           Nothing
-               -> foundNoEntity Nothing
-
-           Just redir@(Redirection _ _ _ _ _)
-               -> handleRedirect env redir
-
-           Just entity@(Entity _ _ _ _ _ _ _ _ _ _ _ _ _ _ _)
-               -> handleGetEntity entity
+           Nothing   -> foundNoEntity Nothing
+           Just page -> if isEntity page then
+                            handleGetEntity page
+                        else
+                            handleRedirect env page
 
 
 {-
@@ -67,6 +63,4 @@ handleGetEntity page
            rev -> foundEntity (strongETag $ show rev) (entityLastMod page)
 
          setContentType (entityType page)
-         setHeader (C8.pack "Content-Disposition")
-                       (C8.pack $ "attachment; filename=" ++ quoteStr (entityFileName' page))
          outputLBS (entityContent page)