1
0

Added a fool proof to remove a trailing slash of a base directoryPath.

This commit is contained in:
Alexander Andreev 2024-12-30 15:31:48 +04:00
parent 73a3b16f29
commit 28488a75c2
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -43,6 +43,10 @@ func main() {
r.Handler(http.MethodGet, "/*filepath", Index)
r.ServeStatic("/assets/*filepath", web.Assets())
if (*directoryPath)[len(*directoryPath)-1] == '/' {
*directoryPath = (*directoryPath)[:len(*directoryPath)-1]
}
var fileServer http.Handler
if *enableFileHandler {
fileServer = http.FileServer(http.Dir(*directoryPath))