]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Resource/Object.hs
Resurrection from slight bitrot.
[Rakka.git] / Rakka / Resource / Object.hs
index 00ebc28e140a622e9d7560e66fb52afc7810adfa..5f5b5c51625c97c6e7524ec8336ca05f379c0432 100644 (file)
@@ -4,8 +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
 import           Rakka.Environment
@@ -34,14 +32,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 +62,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)