]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Resource/PageEntity.hs
Bugfix regarding with URI escaping
[Rakka.git] / Rakka / Resource / PageEntity.hs
index 690695e881bc73c58c6a4c1b127064112fb1e81a..a1d4b02e85da6c2430dad72d61c60d7a7d7d2097 100644 (file)
@@ -28,22 +28,21 @@ 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 . joinPath
+      name :: PageName
+      name = (dropExtension . UTF8.decodeString . joinPath) path
 
 
 handleGet :: Environment -> PageName -> Resource ()