Description

Bad URL is assigned to the "Create new empty page" link (and all the 'create from template' links). For example, for the new page TestTest2 I get http:redwiki:8080/ssingPage?action=edit, but the correct URL should have been http:redwiki:8080/TestTest2?action=edit.

I've also seen http://redwiki:8080/issingPage?action=edit and http://redwiki:8080/s/MissingPage?action=edit

Steps to reproduce

  1. Install Twisted and MoinMoin

  2. Configure a wikifarm with two wikis: redwiki and bluewiki
  3. Set all your config files (mointwisted.py, farmconfig.py, redwiki.py, and bluewiki.py) to have coding: utf-8.
  4. Start the twisted server (./mointwisted start)
  5. Point your browser to http://redwiki:8080

  6. See that the FrontPage is OK.

  7. Create a new WikiWord.

  8. Click on the new WikiWord and see that you have the MissingPage content.

  9. Check the URL for the "Create new empty page" link. Is is OK?

Note: I also tried changing the coding: in all the Config files to iso-8859-1, then deleted and recreated each wiki's data and underlay directories -- but I still had the same problem.

Example

Component selection

Details

MoinMoin Version

1.6.0

OS and Version

OS X 10.4.11

Python Version

2.4

Server Setup

Twisted

Server Details

wikifarm config

Language you are using the wiki in (set in the browser/UserPreferences)

en-us

Workaround

Discussion

[DaveHein, 20-JAN-2008] If someone could tell me where in the source code the URL is generated, I could put some trace statements in there and get more information about how the page name mangling is occuring. [END]

[DaveHein, 20-JAN-2008] OK, the problem seems to be due to Page.send_page() getting called recursively, and that calling self.exists() has a side effect of changing the self.page_name. When the missing page Page object is generated, it starts out life with the correct page_name (e.g. TestMe or MyNewPage) but somewhere in there send_page() calls itself looking for the content of MissingPage to mash into the content.

The problem is that the realPath is something like "/usr/local/var/moin/wikis/redwiki/underlay/pages/MissingPage" and the self.page_name is something like "TestMe" (6 characters long), so we end up with a new page name of "ngPage". :-(

I'm not sure how to signal the code that it shouldn't try to correct the page name in this situation. Advice welcome. [END]

[DaveHein, 20-JAN-2008] I came up with a fix. Essentially, if the last part of the path does not match the page name (in a case-insensitive way), then we shouldn't be trying to change the page name (that is, we should not try to fix the case of the page name, because the path is referencing a different page entirely). The fix is at the end of the Page._setReadPageName() method. Here is the patch to Page.py:

352c352,353
<             self.page_name = realPath[-len(self.page_name):]
---
>             if realPath.lower().endswith( os.sep + self.page_name.lower() ):
>                 self.page_name = realPath[-len(self.page_name):]

[END]

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/1.6.0BadLinkCreateNewEmptyPage (last edited 2008-01-21 00:23:59 by DaveHein)