Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-11617

Spaces with and without trailing whitespace in the name are not listed separately in $xwiki.getSpaces()

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Minor
    • None
    • 6.3
    • Old Core
    • None
    • Unknown

    Description

      I guess this is a "wontfix" as the following is actually standard SQL behaviour, but I guess I report it anyway, so it is documented:

      If adding first a page 'Test.WebHome' and then a page 'Test .WebHome', (with a space after the 'Test'), then this will create two different spaces, but only 'Test' will be returned in $xwiki.getSpaces() . This happens both with HSQL and MySQL.

      The reason for this behaviour is that string comparision in SQL ignores trailing whitespace, if the collation is "PAD SPACE" and e.g. all MySQL collations are of that type (see e.g. http://dev.mysql.com/doc/refman/5.7/en/char.html ).

      That causes the HQL statement select distinct doc.space from XWikiDocument doc order by doc.space asc only to return one of the spaces 'Test' and 'Test ', as they are not distinct from the SQL-point of view.
      Additionally the space index for 'Test' shows both 'WebHome'.
      however if one deletes the 'Test'-space, the 'Test .WebHome' remains, and need to be deleted separately. I recently heard from users who were confused by this. (They added the two different spaces by accident, and were unaware that they had two different spaces.)

      A possible "fix" would be to forbid adding spaces with trailing spaces, or just trim these spaces - at least in the UI. That might even depend on a configuration variable, because if one uses a DB collation with "NO PAD" semantics, one might want to see these two different spaces. (that DB would not be MySQL then, as MySQL does not support this ...)

      If this is not an acceptable fix, however, then please close this as Wontfix.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              camil7 Clemens Robbenhaar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: