Fossil SCM
branch/base-href-fix
The primary purpose of this branch is to fix a problem with #fragment hyperlinks.
The problem is observed on webpages which satisfy all the following conditions:
-
Contain
#fragmentlinks or relative links. -
Have more than one segment in their [
PATH_INFO][] or have non-emptyQUERY_STRING(or both). -
Have
<base>element in their<head>section that does not account for (2).
It turns out that some important pages are affected by this issue: /forumpost,
/forumthread, /tktview, /timeline, /wiki and /wikiedit (and perhaps other).
Notably the /doc pages are not affected unless QUERY_STRING is non-empty
(which makes sense for the TH1-enabled pages).
This issue was discovered earlier under a custom skin and recently became a real obstacle for proper functioning of footnotes within Forum, Tickets and Wiki.
The solution proposed in this branch consists of changing
the value of base href attribute so that it is consistent with the requested URI.
It introduces style_set_base_href_suffix() function that may be called by
a page's handler to override value in base href. If a particular handler
does not call style_set_base_href_suffix() than a regular value
(consistent with the REQUEST_URI) is emited into a page's header.
Thus the change is applied to almost all pages where it seems practical, with
a noteworthy exception of /file pages (that are handled in src/info.c)
and /fileedit pages.
It was chosen not to reuse $current_page variable as it may break
deployments of some users.
Administrators of Fossil instances do not need to take special actions
to benefit from this change, unless a custom header that overrides
the <base> generation is used. In the later case administrator is
advised to amend their code accordingly, unless the old semi-broken
behavior is desired.
Apart from the primary goal this branch also fixes a subtle bug
and introduces (but does not document) auxiliary TH1 variable
and the corresponding class on the <body>.