Multiple Bugs involving Page Name

Multiple Bugs involving Page Name

The Zoho Wiki code that handles the page name has several bugs that transform the name entered by the user into something unwanted, undermining several use cases.  These bugs are not new, but my aggravation about them has recently increased due to needing to use those use cases more frequently.

1. New page: Incorrect handling of hyphens: After entering a Page Name in the Create New Page dialog, the code that handles the new name performs some incorrect and unwanted transformations.  Any hyphens are replaced by [space hyphen space]. This makes it impossible to properly enter an ISO 8601 format date ("2022-09-01") in the page name, or to place in the page name some part numbers in common formats, like "Part ABC-1234, special widget notes".

Examples:

  • "2022-09-01"  becomes "2022 - 09 - 01"
  • "ABC-1234"  becomes "ABC - 1234"
These transformations then undermine searches for those distinctive identifiers.

2. Rename: Incorrect deletion of hyphens:  If the page name with unwanted spaces is then edited in the "Rename Pages as" dialog, to remove the unwanted spaces, the wiki code then incorrectly removes the hyphens as well.

  • "2022 - 09 - 01"  edited to "2022-09-01"  becomes "2022 09 01"

3. New Page URL mess: Page name containing hyphens prompts wiki code to create URL with triple hyphens. These triple hyphens are unnecessary, and make the URL hard to use.  These triple hyphens appear presumably because the wiki code first modifies the Page Name to surround each hyphen with spaces, then the URL-composing code converts those unwanted spaces to hyphens. So the unwanted triple hyphens should be fixed by just removing the code that unwantedly modifies the Page Name.

4. Special characters in the Page name get double-encoded to entities, making them render as entity codes instead of the originally-entered characters.

Reproduce:  Create or rename a page so that it contains, for example, the greater-than character.  The new page name will render in the browser with the string: [ampersand] gt; instead of appearing as the expected greater-than character. The same incorrect render appears in the browser's title bar as well (ie: the title tag in the header).

Now, it probably is necessary to encode the user-entered Page Name once. But perhaps that is already handled by the browser's handling and submission of the user's input?

Troubleshooting gotcha:  You can try to inspect the situation using the browser's Inspector. However, there is a bug in Firefox's inspector where it decodes entities when it should show them verbatim (bug "DevTools Inspector should display HTML Entities not evaluate them" https://bugzilla.mozilla.org/show_bug.cgi?id=967493  , apparently never corrected.)  Google Chrome browser's Inspector gives the correct rendering, and either browser shows the ground truth in their View Source display.

This set of bugs appears to have a common origin, and hopefully would be easy to fix, which would be very much appreciated :-).

Tracking Id: GWZ1047