Skip to content

Recently Updated macro does not load when there is a comment on a child page that contains special characters [ or ] in its title #209

Description

@AndreeaChi

Pro Macros version 1.14.3

On parent Page A, the recently updated macro is used with the type="comment".
Macro syntax:
{{recently-updated types="page, blogpost, spacedesc, attachment, comment" max="5" showProfilePic="false" hideHeading="true"/}}
It's rendering well so far:
image

However, when going on child page of Page A, called [Test, and you add a comment, the display gets broken:
image

Full error output:

org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right
## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
## don't have view right on those pages.
#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference))
  #executeMacro
#else
  {{error}}
    #getMissingLicenseMessage('proMacros.extension.name')
  {{/error}}
#end]
...
Caused by: org.xwiki.velocity.XWikiVelocityException: Failed to evaluate content with namespace [xwiki:HomepageTest.WebHome]
...
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'execute' in  class org.xwiki.query.internal.ScriptQuery threw exception org.xwiki.query.QueryException: Exception while executing query. Query statement = [name:WebHome] at xwiki:HomepageTest.WebHome[line 127, column 33]
...
Caused by: org.xwiki.query.QueryException: Exception while executing query. Query statement = [name:WebHome]
...
Caused by: org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError: Cannot parse 'spaceemoticon_unhappyHomepageTest.[Test)': Encountered "<EOF>" at line 1, column 26.
Was expecting:
    "TO" ...
...
Caused by: org.apache.solr.search.SyntaxError: Cannot parse 'spaceemoticon_unhappyHomepageTest.[Test)': Encountered "<EOF>" at line 1, column 26.
Was expecting:
    "TO" ...
...
Caused by: org.apache.solr.parser.ParseException: Encountered "<EOF>" at line 1, column 26.
Was expecting:
    "TO" ...

Activity

  1. AndreeaChi commented on Feb 14, 2024

    @AndreeaChi
    Author

    So far, it's reproducing when the child page has the following special characters in its title: ], [, and a comment on the page, while on the recently updated macro the comment type is also added.

    It does not reproduce with \ , /, & or ü

  2. changed the title [-]Recently updated macro does not load when there is a comment on a child page that contains special characters in its title[/-] [+]Recently updated macro does not load when there is a comment on a child page that contains special characters [ or ] in its title[/+] on Feb 14, 2024
  3. added this to the 1.14.4 milestone on Feb 14, 2024
  4. raphj commented on Feb 14, 2024

    @raphj
    Contributor

    This required escaping values in a Solr query backing this macro.

  5. changed the title [-]Recently updated macro does not load when there is a comment on a child page that contains special characters [ or ] in its title[/-] [+]Recently Updated macro does not load when there is a comment on a child page that contains special characters [ or ] in its title[/+] on Feb 14, 2024
  6. self-assigned this
    on Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions