Added a fool proof to remove a trailing slash of a base directoryPath.
This commit is contained in:
parent
73a3b16f29
commit
28488a75c2
@ -43,6 +43,10 @@ func main() {
|
|||||||
r.Handler(http.MethodGet, "/*filepath", Index)
|
r.Handler(http.MethodGet, "/*filepath", Index)
|
||||||
r.ServeStatic("/assets/*filepath", web.Assets())
|
r.ServeStatic("/assets/*filepath", web.Assets())
|
||||||
|
|
||||||
|
if (*directoryPath)[len(*directoryPath)-1] == '/' {
|
||||||
|
*directoryPath = (*directoryPath)[:len(*directoryPath)-1]
|
||||||
|
}
|
||||||
|
|
||||||
var fileServer http.Handler
|
var fileServer http.Handler
|
||||||
if *enableFileHandler {
|
if *enableFileHandler {
|
||||||
fileServer = http.FileServer(http.Dir(*directoryPath))
|
fileServer = http.FileServer(http.Dir(*directoryPath))
|
||||||
|
Loading…
Reference in New Issue
Block a user