patch: fix the back option for archives
This commit is contained in:
@@ -286,23 +286,25 @@ func generateArchiveIndex(fsPath string, urlPath string) (string, error) {
|
|||||||
urlPath = basePath(strings.TrimPrefix(urlPath, "/archive"))
|
urlPath = basePath(strings.TrimPrefix(urlPath, "/archive"))
|
||||||
|
|
||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
|
|
||||||
b.WriteString("<html>\n<head><title>Index of ")
|
b.WriteString("<html>\n<head><title>Index of ")
|
||||||
b.WriteString(template.HTMLEscapeString(urlPath))
|
b.WriteString(template.HTMLEscapeString(urlPath))
|
||||||
b.WriteString("</title></head>\n<body>\n<h1>Index of ")
|
b.WriteString("</title></head>\n<body>\n<h1>Index of ")
|
||||||
b.WriteString(template.HTMLEscapeString(urlPath))
|
b.WriteString(template.HTMLEscapeString(urlPath))
|
||||||
b.WriteString("</h1><hr><pre>")
|
b.WriteString("</h1><hr><pre>")
|
||||||
if urlPath != "/archive" && urlPath != "/archive/" {
|
|
||||||
up := path.Dir(urlPath)
|
if urlPath != "/" {
|
||||||
if up == "." {
|
b.WriteString(
|
||||||
up = "/archive"
|
`<a href="/archive` +
|
||||||
}
|
template.HTMLEscapeString(path.Dir(strings.TrimSuffix(urlPath, "/"))) +
|
||||||
if !strings.HasSuffix(up, "/") {
|
`">../</a>` + "\n",
|
||||||
up = "/archive" + filepath.Dir(up) + "/"
|
)
|
||||||
}
|
|
||||||
b.WriteString(`<a href="` + template.HTMLEscapeString(up) + `">../</a>` + "\n")
|
|
||||||
} else {
|
} else {
|
||||||
b.WriteString(`<a href="../">../</a>` + "\n")
|
b.WriteString(
|
||||||
|
`<a href="/">../</a>` + "\n",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
nameCol := 50
|
nameCol := 50
|
||||||
for _, ei := range list {
|
for _, ei := range list {
|
||||||
escapedName := template.HTMLEscapeString(ei.name)
|
escapedName := template.HTMLEscapeString(ei.name)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ var gitCommit string = "devel"
|
|||||||
|
|
||||||
const PROGRAM_NAME string = "fes"
|
const PROGRAM_NAME string = "fes"
|
||||||
const PROGRAM_NAME_LONG string = "fes/fSD"
|
const PROGRAM_NAME_LONG string = "fes/fSD"
|
||||||
const VERSION string = "0.2.0"
|
const VERSION string = "0.2.1"
|
||||||
|
|
||||||
func Version() {
|
func Version() {
|
||||||
fmt.Printf("%s version %s\n", PROGRAM_NAME_LONG, VERSION)
|
fmt.Printf("%s version %s\n", PROGRAM_NAME_LONG, VERSION)
|
||||||
|
|||||||
Reference in New Issue
Block a user