Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-27562

Links in the RichText containing certain characters throw a validation error

    XMLWordPrintable

    Details

      Description

      When trying to link some text inside RichText to external url ( https://www.google.ch/maps/place/Tobler+Technique+du+B%C3%83%C2%A2timent+SA+[March%C3%83%C2%A9+Tobler]/@46.101331,7.0872363,17z/data=!3m1!4b1!4m5!3m4!1s0x478ec9ca57e24dd7:0xf0ff4cc3a15b81c2!8m2!3d46.101331!4d7.089425 ) which contains unmasked chars like `[` or `]` the validation fails with error Validation of XML content failed:↵Error in 212:0: Element section has extra content: itemizedlist.

      Update (eZ Support):

      This issue happens when trying to link inside RichText to an external URL that contains characters: "]", "[" or "%". I tested more of them, but only these ones were causing the issue to occur. This would probably require proper Q&A testing after the patch is ready to cover all the possible cases.
      URL encoding the characters manually seems to be a workaround for this issue, but I think it still should be allowed to provide unencoded ones.
      When the validation error is thrown, there is also an error thrown in the browser console: "_ezcombo?app-base/app-base-min.js&querystring-stringify-simple/querystring-stringify-simple-min.js&…:1687 POST http://ezplatform.dev/api/ezp/v2/content/objects/71/versions/1 400 (Bad Request)". The response to this request looks like this:

      {
          "ErrorMessage": {
              "_media-type": "application\/vnd.ez.api.ErrorMessage+json",
              "errorCode": 400,
              "errorMessage": "Bad Request",
              "errorDescription": "Content fields did not validate",
              "errorDetails": {
                  "fields": [
                      {
                          "_fieldTypeId": 120,
                          "errors": [
                              {
                                  "type": null,
                                  "message": "Validation of XML content failed:\nError in 18:0: Element section has extra content: para"
                              }
                          ]
                      }
                  ]
              },
              "trace": "#0 C:\\Apache24\\htdocs\\ezplatform\\vendor\\ezsystems\\platform-ui-bundle\\Controller\\Rest\\ContentController.php(92): eZ\\Publish\\Core\\REST\\Server\\Controller\\Content->updateVersion('71', '1', Object(Symfony\\Component\\HttpFoundation\\Request))\n#1 [internal function]: EzSystems\\PlatformUIBundle\\Controller\\Rest\\ContentController->updateVersion('71', '1', Object(Symfony\\Component\\HttpFoundation\\Request))\n#2 C:\\Apache24\\htdocs\\ezplatform\\vendor\\symfony\\symfony\\src\\Symfony\\Component\\HttpKernel\\HttpKernel.php(144): call_user_func_array(Array, Array)\n#3 C:\\Apache24\\htdocs\\ezplatform\\vendor\\symfony\\symfony\\src\\Symfony\\Component\\HttpKernel\\HttpKernel.php(64): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#4 C:\\Apache24\\htdocs\\ezplatform\\vendor\\symfony\\symfony\\src\\Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel.php(69): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#5 C:\\Apache24\\htdocs\\ezplatform\\vendor\\symfony\\symfony\\src\\Symfony\\Component\\HttpKernel\\Kernel.php(185): Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#6 C:\\Apache24\\htdocs\\ezplatform\\web\\app.php(70): Symfony\\Component\\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#7 {main}",
              "file": "C:\\Apache24\\htdocs\\ezplatform\\vendor\\ezsystems\\ezpublish-kernel\\eZ\\Publish\\Core\\REST\\Server\\Controller\\Content.php",
              "line": 469
          }
      }
      

      Steps to reproduce:

      1. Create new eZPlatform project.
      2. In PlatformUI panel, go to Content/Content structure and click "Create". Select "Article" from available Content Types.
      3. Write something in the "Intro" field, for example "asd".
      4. Double click on "asd". The menu will be shown, select "Link".
      5. In "Link to" field enter something that has characters: "]", "[" or "%", for example "https://www.test.com/[test]" or "https://www.test.com/%test".
      6. Click "Save" and then try to save the article. You will be presented with validation error for "Intro" field.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              andraz.jalovec@origammi.co Andraž Jalovec Jalovec
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: