diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-02-05 18:36:40 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-02-05 18:36:40 +0100 |
| commit | 7093f5147c3ffac224eaae84fb986b1f65b39bbe (patch) | |
| tree | f73bb77ef71c317c64f8617af0c2dd1226073b46 | |
| parent | 8db503b392040adec9742880991dc8a9d6f3bb7c (diff) | |
| download | chawan-7093f5147c3ffac224eaae84fb986b1f65b39bbe.tar.gz | |
file: fix directory listing
| -rw-r--r-- | adapter/protocol/file.nim | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/adapter/protocol/file.nim b/adapter/protocol/file.nim index b18a3291..9d2c2758 100644 --- a/adapter/protocol/file.nim +++ b/adapter/protocol/file.nim @@ -77,14 +77,13 @@ proc loadFile(ps: PosixStream) = proc main() = let opath = getEnv("MAPPED_URI_PATH") let path = percentDecode(opath) - let ps = newPosixStream(path) - if ps != nil: - loadFile(ps) - elif dirExists(path): + if dirExists(path): if path[^1] != '/': stdout.write("Status: 301\nLocation: " & path & "/\n") else: loadDir(path, opath) + elif (let ps = newPosixStream(path); ps != nil): + loadFile(ps) else: stdout.write("Cha-Control: ConnectionError FileNotFound") |