Bug? The AppWithinPage Page picker strips out trailing spaces in the page's URL

I tore my hair out all Friday because my page picker would return broken links for the field if the user changed anything at all on the page.

To reproduce:

  1. Create a page, and “accidentally” put a trailing space after the page title.

  2. On another page that uses the page picker, select the page created in Step 1. Once you Save and Edit, the link to the page will work fine.

  3. Now go into edit mode on that second page (in step 2), and make any change to the page, save and edit.

  4. In view mode, the link to the page created in Step 1 will be broken. Xwiki will have stripped out the trailing space (%20) from the doc’s fullName

I can’t reproduce on a clean XWiki 11.9 instance. Here’s what I did:

  • I created a new plain wiki page Foo then I edited it with the class editor and I added a single property named “page” of type Page. I left the default Page property settings, except for Display Type which I changed from select to input, in order to have the input suggest picker.
  • I added an object of type Foo to the Foo page
  • in the content of the Foo page I put this:
    {{velocity}}$doc.display('page'){{/velocity}}
    
  • I created another page named "Bar " (with a space at the end)
  • I edited the Foo page using the “Inline Form” edit mode
  • I typed “bar” into the page picker and selected the suggestion corresponding to the Bar page
  • I saved. The URL was OK.
  • I edited again the Foo page in “Inline Form” edit mode and I saved without changes. The URL was still OK.
  • Repeated this after enabling multiple selection on the page property. Still OK.

Did I miss something?

Thanks,
Marius

That sounds about right. I’m on version 10.11.9, so maybe this was corrected on a release? I have this problem with every page element on the various app within minutes aps that I have (and I have many).

ETA: Come to think of it, it’s not the same.

The differences that I see with your example is that you’re aren’t using AppWithinMinutes to create your class, and I am for all of mine. Additionally, I am limiting the choices for the input by either using an AppWithinMinutes generated class name (for an app that I created) or I use a custom HQL call.

In a nutshell, the Page Picker is trying to use a listing of pages for a particular AppWithinMinutes class.

Additionally, there is another bug that if the field is null, using $doc.display(‘page’) will not leave an empty space in view mode, it will put a link to the home page of the AppWithinMinutes app.