[bug] Two hyperlinks on /tktview do not follow --baseurl
(1) By ecd on 2025-11-26 09:55:24 [source]
Hello all,
The "Copy Ticket" and "Edit Wiki" hyperlinks on the /tktview/ page do not follow --baseurl. This results in a broken link if the repository is not hosted at the root of the URL.
Minimum working example (MWE) showing the bug:
$ echo 'GET /tktview/f0a4cdc791 HTTP/1.1' | env REMOTE_ADDR=127.0.0.1 fossil http ~/fossils/fossil.fossil --localauth --baseurl http://127.0.0.1/feliznavidad | grep -E "(Copy Ticket|Edit Wiki)"
<a class="label sml-copy-ticket" href="/tktnew/f0a4cdc7915a946edd18b22b5451dd2b2e4dc5cc">Copy Ticket</a>
<a class="label sml-edit-wiki" href="/wikiedit?name=ticket/f0a4cdc7915a946edd18b22b5451dd2b2e4dc5cc">Edit Wiki</a>
After patching:
$ echo 'GET /tktview/f0a4cdc791 HTTP/1.1' | env REMOTE_ADDR=127.0.0.1 ./fossil http ~/fossils/fossil.fossil --localauth --baseurl http://127.0.0.1/feliznavidad | grep -E "(Copy Ticket|Edit Wiki)"
<a class="label sml-copy-ticket" href="http://127.0.0.1/feliznavidad/tktnew/f0a4cdc7915a946edd18b22b5451dd2b2e4dc5cc">Copy Ticket</a>
<a class="label sml-edit-wiki" href="http://127.0.0.1/feliznavidad/wikiedit?name=ticket/f0a4cdc7915a946edd18b22b5451dd2b2e4dc5cc">Edit Wiki</a>
Here is the patch I applied:
Index: src/tktsetup.c
==================================================================
--- src/tktsetup.c
+++ src/tktsetup.c
@@ -494,14 +494,14 @@
@ html "<td class='tktDspValue' colspan='3'>Deleted</td></tr>\n"
@ }
@ }
@
@ if {[capexpr {n}]} {
-@ submenu link "Copy Ticket" /tktnew/$tkt_uuid
+@ submenu link "Copy Ticket" $baseurl/tktnew/$tkt_uuid
@ }
@ if {[capexpr {nk}]} {
-@ submenu link "Edit Wiki" /wikiedit?name=ticket/$tkt_uuid
+@ submenu link "Edit Wiki" $baseurl/wikiedit?name=ticket/$tkt_uuid
@ }
@ </th1>
@ <tr><td class="tktDspLabel">Title:</td>
@ <td class="tktDspValue" colspan="3">
@ $<title>
license: public domain / https://creativecommons.org/public-domain/cc0/
(2) By Richard Hipp (drh) on 2025-11-26 11:31:00 in reply to 1 [link] [source]
The suggested patch appears to be correct.
You understand that code is not baked-in, right? The edited code is just the default script text for part of the ticket setup. You can fix the problem locally by editing your ticket setup, and without updating to the latest Fossil check-in.
(3) By ecd on 2025-11-26 22:32:49 in reply to 2 [link] [source]
Thank you for the blazing fast turnaround!
You can fix the problem locally by editing your ticket setup
Thank you for the suggestion. I run a small public-facing fossil hosting website with about a hundred repositories, so I don't want to edit or customize anything for each of these repositories as that may interfere with the users' own customizations. Instead, I prefer patching the hardcoded defaults whenever possible, which doesn't affect user customizations and is also easier since all I have to do is patch the fossil source tree before building.