pathClean works like path.Clean but will always preserve a trailing slash.
(p string)
| 92 | |
| 93 | // pathClean works like path.Clean but will always preserve a trailing slash. |
| 94 | func pathClean(p string) string { |
| 95 | hadSlash := strings.HasSuffix(p, "/") |
| 96 | p = path.Clean(p) |
| 97 | if hadSlash && !strings.HasSuffix(p, "/") { |
| 98 | p += "/" |
| 99 | } |
| 100 | return p |
| 101 | } |
| 102 | |
| 103 | // trimIndexHTML remaps paths matching "<dir>/index.html" to "<dir>/". |
| 104 | func trimIndexHTML(p string) string { |
no outgoing calls