Hi!
After installing and testing XWiki v14.2.1 I see two issues I wasn’t able to resolve so far.
-
Blog articles with an ampersand ("&") in the title (like “Test & Co”) show a “#38;” character sequence (like “Test & Co
”) in the list of newest blog articles (the Blog.RecentPostsPanel
)
The page title is correctly shown as “Test & Co” on the article page itself and also in the list of latest changes (Panels.Recently Modified
), though. This is with v9.11.5 of the Blog Application.
-
The Mocca Calendar Application (v2.8) is broken. It doesn’t show the calendar at all.
It seems, the page can not load the required “moment” JavaScript library.
When accessing a page with the mocca calendar macro, I see a 404 error for the following GET request:
"GET /xwiki/webjars/wiki%3Axwiki/momentjs/2.29.1/min/moment.min/min/moment.min.js HTTP/1.1"
The webjar is installed:
$ ll /usr/lib/xwiki/WEB-INF/lib/momentjs*
-rw-r--r-- 1 root root 918301 Mar 31 11:58 /usr/lib/xwiki/WEB-INF/lib/momentjs-2.29.1.jar
-rw-r--r-- 1 root root 1382 Mar 31 11:58 /usr/lib/xwiki/WEB-INF/lib/momentjs-2.29.1.xed
And it also contains the moment.min.js library:
$ unzip -l /usr/lib/xwiki/WEB-INF/lib/momentjs-2.29.1.jar | grep moment.min.js
58862 2020-10-06 05:13 META-INF/resources/webjars/momentjs/2.29.1/min/moment.min.js
But: the path in the GET request seems to be wrong, as it contains an additional “min/moment.min/” prefix which does not match the contents of the webjar. So I’m not surprised it can’t find the required library…
On an older v9.11.4 installation I don’t see any of those issues.
The XWiki 14.2.1 installation is pretty standard according to the docs: it is running on a current Debian Bullseye with Tomcat 9 and a nginx proxy in front. RDBMS is PostgreSQL v13, JVM is OpenJDK v11.0.14
Any suggestion on how to proceed?
Thanks!
- andreas
Here’s an update on issue (1)!
I copied the velocity code to show the recent blog posts from the XWiki Blog pages and put it directly in a sandbox page.
This is the code:
{{include reference="Blog.BlogCode"/}}
{{velocity}}
#getAllBlogPostsQueryBasedOnDisplayContext($doc $query $queryParams)
#set($query = "$!{query} and isPublished.value = 1 and hidden.value <> 1")
#set ($queryObj = $services.query.hql("${query} order by publishDate.value desc").addFilter("unique"))
#bindQueryParameters($queryObj $queryParams)
#if($queryObj.setLimit(10).setOffset(0).count() > 0 || $showEmptyPanels)
#panelheader($services.localization.render('blog.recentposts.paneltitle'))
#displayBlogPostsBasedOnContext($doc 'recent' 'link' '' 10)
#panelfooter()
#end
{{/velocity}}
And guess what: with this code in the sandbox page the page title with the ampersand is rendered correctly!
The HTML code generated for the sandbox page shows:
<h1 class="xwikipaneltitle">Neuste Blog Beiträge</h1>
<div class="xwikipanelcontents">
<ul class="blog-post-layout-link">
<li><span class="fa fa-arrow-right"></span> <span class="wikilink"><a href="/xwiki/bin/view/Blog/Test%20%26%20Co">Test & Co</a></span></li>
</ul>
And the browser renders the link as
Test & Co
This is what I want, of course.
But with Blog.RecentPostsPanel
on the right menu panel the list shows the following HTML code:
<h1 class="xwikipaneltitle">Neuste Blog Beiträge</h1>
<div class="xwikipanelcontents">
<ul class="blog-post-layout-link">
<li><span class="fa fa-arrow-right"></span> <span class="wikilink"><a href="/xwiki/bin/view/Blog/Test%20%26%20Co">Test &#38; Co</a></span></li>
</ul>
And the link is rendered by the browser as
Test & Co
You can see clearly that in the menu panel on the right side there are additional amp;
characters in the link text if the title of the blog article contains an ampersand.
Where do these additional characters come from? How can I get rid of them?
Any idea anyone?
Another update on issue (1)…
This issue seems to be identical with Loading...
Here’s an update on issue (2)…
I “fixed” the wrong path in the GET request using a simple redirect rule in NGINX.
This is the redirect rule I currently use for that purpose:
location /xwiki/webjars/wiki:xwiki/momentjs/2.29.1/min/moment.min/min/moment.min.js {
# XWiki Mocca Calendar app uses a wrong path when loading the moment.min.js JavaScript library
# We fix this here by simply redirecting the browser from the wrong path to the correct one...
# Note: this has to be adjusted every time when XWiki is updated with a new version of the momentjs library
# (or when the bug is finally fixed in the Mocca calendar app)
# Added by AH, 19.04.2022
return 301 /xwiki/webjars/wiki:xwiki/momentjs/2.29.1/min/moment.min.js;
}
And this is the effect when XWiki tries to load the calendar app as can be seen in the NGINX logfile: first the browser tries to load moment.bin.js
using the wrong path, gets a 301 and then uses the correct path and the server successfully delivers the library with a 200 status code:
10.10.115.46 - - [19/Apr/2022:17:54:40 +0200] "GET /xwiki/webjars/wiki%3Axwiki/momentjs/2.29.1/min/moment.min/min/moment.min.js HTTP/1.1" 301 169 "http://192.168.5.40/xwiki/bin/view/Main/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36"
10.10.115.46 - - [19/Apr/2022:17:54:40 +0200] "GET /xwiki/webjars/wiki:xwiki/momentjs/2.29.1/min/moment.min.js HTTP/1.1" 200 58930 "http://192.168.5.40/xwiki/bin/view/Main/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36"
An now the calendar is properly rendered in the browser…
I think this could be a sufficient solution until the bug is fixed in the Mocca calendar app.
Comments?
- andreas