about summary refs log tree commit diff stats
path: root/adapter/protocol/file.nim
diff options
context:
space:
mode:
Diffstat (limited to 'adapter/protocol/file.nim')
-rw-r--r--adapter/protocol/file.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/adapter/protocol/file.nim b/adapter/protocol/file.nim
index 168be58b..d05d558c 100644
--- a/adapter/protocol/file.nim
+++ b/adapter/protocol/file.nim
@@ -9,11 +9,11 @@ import dirlist
 import loader/connecterror
 import utils/twtstr
 
-proc loadDir(path: string) =
+proc loadDir(path, opath: string) =
   var path = path
   if path[^1] != '/': #TODO dos/windows
     path &= '/'
-  var base = getEnv("QUERY_STRING")
+  var base = "file://" & opath
   if base[^1] != '/': #TODO dos/windows
     base &= '/'
   stdout.write("Content-Type: text/html\n\n")
@@ -96,11 +96,12 @@ proc loadFile(istream: Stream) =
         break
 
 proc main() =
-  let path = percentDecode(getEnv("MAPPED_URI_PATH"))
+  let opath = getEnv("MAPPED_URI_PATH")
+  let path = percentDecode(opath)
   let istream = newFileStream(path, fmRead)
   if istream == nil:
     if dirExists(path):
-      loadDir(path)
+      loadDir(path, opath)
     elif symlinkExists(path):
       loadSymlink(path)
     else: