chore: fix usage bug

This commit is contained in:
xuu 2025-04-02 16:09:11 -06:00
parent 73eaac5bc6
commit fc200cf84f
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F

View File

@ -203,14 +203,13 @@ func addKey(preamble lextwt.Comments, key, value string, v ...any) lextwt.Commen
}
func mkPreamble(hostname, uri, path string, limit int, length, offset, end int64) lextwt.Comments {
hostname += path
preamble := addKey(mkPreambleDocs(hostname), "twt range", "1 %d", end)
preamble = addKey(preamble, "self", "%s%s", hostname, mkqry(uri, limit, offset))
preamble = addKey(preamble, "self", "%s%s%s", hostname, path, mkqry(uri, limit, offset))
if next := offset + length; next < end {
preamble = addKey(preamble, "next", "%s%s", hostname, mkqry(uri, limit, next))
preamble = addKey(preamble, "next", "%s%s%s", hostname, path, mkqry(uri, limit, next))
}
if prev := offset - int64(limit); prev > 0 {
preamble = addKey(preamble, "prev", "%s%s", hostname, mkqry(uri, limit, prev))
preamble = addKey(preamble, "prev", "%s%s%s", hostname, path, mkqry(uri, limit, prev))
}
return preamble
}