]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Resource/PageEntity.hs
Bugfix regarding with URI escaping
[Rakka.git] / Rakka / Resource / PageEntity.hs
index a9eff98ac6c1890741ca546d7e0028c935f157c5..a1d4b02e85da6c2430dad72d61c60d7a7d7d2097 100644 (file)
@@ -11,7 +11,6 @@ import qualified Data.Map as M
 import           Data.Maybe
 import           Data.Time
 import           Network.HTTP.Lucu
-import           Network.HTTP.Lucu.Utils
 import           Network.URI hiding (path)
 import           Rakka.Environment
 import           Rakka.Page
@@ -21,31 +20,29 @@ import           Rakka.SystemConfig
 import           Rakka.Utils
 import           Rakka.W3CDateTime
 import           Rakka.Wiki.Engine
-import           System.FilePath
+import           System.FilePath.Posix
 import           Text.HyperEstraier hiding (getText)
 import           Text.XML.HXT.Arrow
-import           Text.XML.HXT.DOM.TypeDefs
-import           Text.XML.HXT.DOM.XmlKeywords
+import           Text.XML.HXT.XPath
 
 
 fallbackPageEntity :: Environment -> [String] -> IO (Maybe ResourceDef)
 fallbackPageEntity env path
-    | null path                  = return Nothing
-    | null $ head path           = return Nothing
-    | isLower $ head $ head path = return Nothing -- 先頭の文字が小文字であってはならない
+    | null name           = return Nothing
+    | isLower $ head name = return Nothing -- 先頭の文字が小文字であってはならない
     | otherwise
         = return $ Just $ ResourceDef {
             resUsesNativeThread = False
           , resIsGreedy         = True
-          , resGet              = Just $ handleGet    env (toPageName path)
+          , resGet              = Just $ handleGet    env name
           , resHead             = Nothing
           , resPost             = Nothing
-          , resPut              = Just $ handlePut    env (toPageName path)
-          , resDelete           = Just $ handleDelete env (toPageName path)
+          , resPut              = Just $ handlePut    env name
+          , resDelete           = Just $ handleDelete env name
           }
     where
-      toPageName :: [String] -> PageName
-      toPageName = decodePageName . dropExtension . joinWith "/"
+      name :: PageName
+      name = (dropExtension . UTF8.decodeString . joinPath) path
 
 
 handleGet :: Environment -> PageName -> Resource ()