Description
The locations generated by the action sitemap.py contain the scriptname twice and point therefore to nonexistent locations if the scriptname is not empty.
Steps to reproduce
1. Create a wiki which is not located at the / of your webserver.
http://example.tld/mywiki/ - will show the bug
http://example.tld/ - won't show the bug (because scriptname is empty, see below)
2. Fetch a sitemap from the wiki (located at http://example.tld/mywiki/)
wget 'http://example.tld/mywiki/FrontPage?action=sitemap' -O sitemap.xml
3. the entries will look this:
<url> <loc>http://example.tld/mywiki/mywiki/FrontPage</loc> <lastmod>2007-06-16T14:58:29+00:00</lastmod> <changefreq>daily</changefreq> <priority>1.0</priority> </url>
Note, the mywiki/mywiki in http://example.tld/mywiki/mywiki/FrontPage.
Example
This is not my page, so be gentle.
http://wiki.xensource.com/xenwiki/FrontPage ? action=sitemap (unknown MoinMoin version)
http://en.wiki.mesemb.ru/wiki/FrontPage ? action=sitemap (MoinMoin 1.7.2; now works as IvanBoldyrev applied a patch)
Component selection
- !MoinMoin/action/sitemap.py
Details
MoinMoin Version |
Version 1.5.8 [Revision release] |
See
The <loc> field gets written by the following code (line-numbers according to this version):
19 def make_url_xml(vars): 20 """ assemble a single <url> xml fragment """ 21 return """\ 22 <url> 23 <loc>%(base)s%(url)s</loc> 24 <lastmod>%(lastmod)s</lastmod> 25 <changefreq>%(changefreq)s</changefreq> 26 <priority>%(priority)s</priority> 27 </url> 28 """ % vars
where
30 def sitemap_url(request, base, page): 32 url = page.url(request)
and
62 def execute(pagename, request): 66 base = request.getBaseURL()
Both page.url() and request.getBaseURL return the scriptname (as documented in their docstrings), which explains the double scriptname "mywiki/mywiki".
Workaround
See changeset with fix below.
Discussion
I changed status from Fixed to not-fixed because this bug is reproducible in MM 1.7.2 and I see no traces of patch mentioned below in released sources. -- IvanBoldyrev 2008-09-20 17:51:34
Yes, you are right. It was fixed in 1.5 and obviously I forgot to forward-port that fix to 1.6 (and newer versions). As 1.6 is rather closed meanwhile I directly ported the patch to 1.7 now. -- ThomasWaldmann 2008-09-21 09:04:51
I've applied the patch to my installation, sitemap has correct URLs. Thanks! -- IvanBoldyrev 2008-09-21 16:13:03
Plan
- Priority:
Assigned to: ThomasWaldmann
- Status:
fixed in 1.5: http://hg.moinmo.in/moin/1.5/rev/82684ab6afcd (please help testing it and report back if it worked)
- not fixed in 1.6 (if you like, you can apply the 1.7 patch)
fixed in 1.7: http://hg.moinmo.in/moin/1.7/rev/25902b15fcce (please help testing it and report back if it worked)