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

Embedded content throws exception after it is moved to trash

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 1.7.5, 1.11.0
    • Fix Version/s: 1.12.1, 1.7.7
    • Component/s: Platform stack
    • Labels:
      None

      Description

      If the Content Object (eg. File) is embedded using Rich Text Field into another Content Object (eg. Folder) and the former is deleted (moved to trash), then displaying the Folder Content Object in the front-office should not include the deleted File Content Object. Currently, however, the following exception is thrown:

      Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Cannot generate an UrlAlias route for content without main location.")." at xxx\vendor\ezsystems\ezpublish-kernel\eZ\Bundle\EzPublishCoreBundle/Resources/views/default/content/embed.html.twig line 6
      Context: { "exception": "Exception(Twig_Error_Runtime): An exception has been thrown during the rendering of a template (\"Cannot generate an UrlAlias route for content without main location.\")." }
      

      There is a similar problem in the eZ Publish, but since steps to reproduce are a little different and the end result is also different, I have separated the issues. The one regarding eZ Publish 5.4 can be found here: EZP-28122.

      Steps to reproduce

      1. Create new eZ Platform installation.
      2. In the back-office, create new Folder Content Type under "eZ Platform" named "Test Folder".
      3. In the Media/Files, create new File Content Type named "Test File".
      4. Edit the "Test Folder". In the "Description" field, embed the "Test file" using the "+" and "Embed" buttons from the Rich Text Editor. Publish "Test Folder".
      5. In the front-office, navigate to "/Test-Folder". Confirm that the embedded Content Object "Test file" is also displayed.
      6. In the backoffice, navigate to "Media/Files/Test file" and remove it by sending it to trash.
      7. In the front-office, navigate to "/Test-Folder" again. If you are using "dev" environment, the above exception will be displayed. If you are using "prod" environment, you can find the following exception in the app/logs/prod.log file:
        [2017-10-23 14:14:47] request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Cannot generate an UrlAlias route for content without main location.")." at C:\Apache24\htdocs\ezplatform\vendor\ezsystems\ezpublish-kernel\eZ\Bundle\EzPublishCoreBundle/Resources/views/default/content/embed.html.twig line 6 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"Cannot generate an UrlAlias route for content without main location.\"). at C:\\Apache24\\htdocs\\ezplatform\\vendor\\ezsystems\\ezpublish-kernel\\eZ\\Bundle\\EzPublishCoreBundle/Resources/views/default/content/embed.html.twig:6, LogicException(code: 0): Cannot generate an UrlAlias route for content without main location. at C:\\Apache24\\htdocs\\ezplatform\\vendor\\ezsystems\\ezpublish-kernel\\eZ\\Publish\\Core\\MVC\\Symfony\\Routing\\UrlAliasRouter.php:345)"} []
        

        Attachments

        1. ezp-28123_1_7.patch
          14 kB
        2. EZP-28123_for_1_12.patch
          14 kB
        3. ezp-28123 chrome.png
          ezp-28123 chrome.png
          62 kB
        4. ezp-28123 chrome incognito.png
          ezp-28123 chrome incognito.png
          68 kB

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              jacek.foremski-obsolete@ez.no Jacek Foremski (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: