@@ -113,7 +113,7 @@ proc sendDirContents(settings: NimHttpSettings, dir: string): NimHttpResponse =
113
113
let subtitle = path.relativePath (cwd)
114
114
for i in walkDir (path):
115
115
let name = i.path.extractFilename
116
- let relpath = i.path.relativePath (cwd )
116
+ let relpath = i.path.relativePath (path). strip (chars = { '/' }, trailing = false )
117
117
if name == " index.html" or name == " index.htm" :
118
118
return sendStaticFile (settings, i.path)
119
119
if i.path.dirExists:
@@ -136,7 +136,7 @@ proc logmsg(msg: string, log: bool) =
136
136
if log:
137
137
echo msg
138
138
139
- proc getPut (req: Request , path, backup: string , log: bool ): NimHttpResponse =
139
+ proc getPut (req: Request , path, backup: string , log: bool ): NimHttpResponse =
140
140
let content = req.body
141
141
writeFile (path, content)
142
142
logmsg (" Update: " & path, log)
@@ -171,7 +171,7 @@ proc savePost(req: Request, path, url_path: string, log: bool): NimHttpResponse
171
171
172
172
writeFile (path / newName, file_body)
173
173
let
174
- rsp_msg = " Save file to " & newName
174
+ rsp_msg = " Save file to " & newName
175
175
msg = rsp_msg & " in " & path
176
176
rsp_content = rsp_msg
177
177
code = Http200
@@ -314,7 +314,7 @@ echo(" Backup dir: ", backup)
314
314
proc handleCtrlC () {.noconv .} =
315
315
write (stdout, " \r Clean backups (y to clean): " )
316
316
let clean = readLine (stdin)
317
-
317
+
318
318
var cleaned = 0
319
319
if " y" == clean:
320
320
cleaned = clean_backup (dir, backup)
0 commit comments