forked from tslocum/twins
Strip path from root
If there is a path (the URL path) specified under paths in the configuration, which points to a root (a physical folder on the filesystem), this path should not be attached to the root. This fix will do that. It strips the path from the root. Example configuration: hosts: localhost: paths: - path: /a root: public/aroot - path: / root: public Filesystem: + public + index.gmi + aroot + index.gmi
This commit is contained in:
parent
cd85204680
commit
bd0555069e
|
@ -80,7 +80,9 @@ func serveHTTPS(w http.ResponseWriter, r *http.Request) (int, int64, string) {
|
|||
root += "/"
|
||||
}
|
||||
|
||||
requestSplit := strings.Split(r.URL.Path, "/")
|
||||
// We remove the the path (specified in the config file) from the actual URL, so
|
||||
// it will not prefixed two times to the root.
|
||||
requestSplit := strings.Split(r.URL.Path[len(serve.Path)-1:], "/")
|
||||
|
||||
if !serve.SymLinks {
|
||||
for i := 1; i < len(requestSplit); i++ {
|
||||
|
|
Loading…
Reference in New Issue