From: PHO Date: Thu, 18 Feb 2010 16:12:49 +0000 (+0900) Subject: Bugfix regarding with URI escaping X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=98fd1cb53a837a9bda7145544c34872acb13a634;p=Rakka.git Bugfix regarding with URI escaping --- diff --git a/Rakka/Resource/Object.hs b/Rakka/Resource/Object.hs index 5f5b5c5..d4db7db 100644 --- a/Rakka/Resource/Object.hs +++ b/Rakka/Resource/Object.hs @@ -4,12 +4,13 @@ module Rakka.Resource.Object ) where +import qualified Codec.Binary.UTF8.String as UTF8 import Network.HTTP.Lucu -import Network.HTTP.Lucu.Utils import Rakka.Environment import Rakka.Page import Rakka.Storage import Rakka.SystemConfig +import System.FilePath.Posix resObject :: Environment -> ResourceDef @@ -25,7 +26,7 @@ resObject env } where toPageName :: [String] -> PageName - toPageName = decodePageName . joinWith "/" + toPageName = UTF8.decodeString . joinPath handleGet :: Environment -> PageName -> Resource () diff --git a/Rakka/Resource/PageEntity.hs b/Rakka/Resource/PageEntity.hs index 690695e..a1d4b02 100644 --- a/Rakka/Resource/PageEntity.hs +++ b/Rakka/Resource/PageEntity.hs @@ -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 () diff --git a/Rakka/Resource/Render.hs b/Rakka/Resource/Render.hs index 18a7dc5..64c159e 100644 --- a/Rakka/Resource/Render.hs +++ b/Rakka/Resource/Render.hs @@ -3,18 +3,19 @@ module Rakka.Resource.Render ) where +import qualified Codec.Binary.UTF8.String as UTF8 import Control.Arrow import Control.Arrow.ArrowIO import Control.Arrow.ArrowList import Control.Monad.Trans import qualified Data.ByteString.Lazy as Lazy import Network.HTTP.Lucu -import Network.HTTP.Lucu.Utils import OpenSSL.EVP.Base64 import Rakka.Environment import Rakka.Page import Rakka.Utils import Rakka.Wiki.Engine +import System.FilePath.Posix import Text.XML.HXT.Arrow.Namespace import Text.XML.HXT.Arrow.WriteDocument import Text.XML.HXT.Arrow.XmlArrow @@ -36,7 +37,7 @@ resRender env } where toPageName :: [String] -> PageName - toPageName = decodePageName . joinWith "/" + toPageName = UTF8.decodeString . joinPath {- diff --git a/Rakka/Resource/TrackBack.hs b/Rakka/Resource/TrackBack.hs index 260d222..1bcdbf9 100644 --- a/Rakka/Resource/TrackBack.hs +++ b/Rakka/Resource/TrackBack.hs @@ -14,7 +14,6 @@ import Network.Browser import Network.HTTP import Network.HTTP.Lucu import Network.HTTP.Lucu.Response -import Network.HTTP.Lucu.Utils import Network.URI import Rakka.Environment import Rakka.Page @@ -47,7 +46,7 @@ resTrackBack env } where toPageName :: [String] -> PageName - toPageName = decodePageName . joinWith "/" + toPageName = UTF8.decodeString . joinPath handlePost :: Environment -> PageName -> Resource ()