From 1d251b23951d39ae98b8013782865f355c23fff2 Mon Sep 17 00:00:00 2001 From: hallgren Date: Mon, 27 Jan 2014 16:30:03 +0000 Subject: [PATCH] gf -server: fix a redirection bug... ...that was introduced with the recent changes to the handling of the current working directory --- src/compiler/GFServer.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs index 5d4825829..6160a9f43 100644 --- a/src/compiler/GFServer.hs +++ b/src/compiler/GFServer.hs @@ -154,7 +154,7 @@ handle documentroot state0 cache execute1 stateVar wrapCGI $ PS.cgiMain' cache path (dir,"grammars.cgi",_ ) -> grammarList dir (decoded qs) (dir ,"exb.fcgi" ,_ ) -> wrapCGI $ ES.cgiMain' root dir (fst cache) - _ -> serveStaticFile path + _ -> serveStaticFile rpath path where path = translatePath rpath _ -> return $ resp400 upath @@ -262,7 +262,7 @@ handle documentroot state0 cache execute1 stateVar else err $ resp404 path rm path = err $ resp400 $ "unacceptable extension "++path - download path = liftIO $ serveStaticFile path + download path = liftIO $ serveStaticFile' path link_directories olddir newdir@('/':'t':'m':'p':'/':_) | old/=new = hmInDir ".." $ liftIO $ @@ -315,13 +315,13 @@ jsonresult cwd dir cmd (ecode,stdout,stderr) files = -- * Static content -serveStaticFile path = +serveStaticFile rpath path = do --logPutStrLn $ "Serving static file "++path b <- doesDirectoryExist path if b - then if path `elem` ["","."] || last path=='/' + then if rpath `elem` ["","."] || last path=='/' then serveStaticFile' (path "index.html") - else return (resp301 (path++"/")) + else return (resp301 ('/':rpath++"/")) else serveStaticFile' path serveStaticFile' path =