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

File seems to be treated as Image when linking to it

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 5.4.0, 5.4.1
    • Fix Version/s: Customer request
    • Component/s: DemoBundle
    • Labels:
      None
    • Environment:

      eZ Publish 5.4.0

      Description

      When linking to a file located under storage/original/application/ the following exception is thrown:

      CRITICAL - Uncaught PHP Exception eZ\Publish\Core\Base\Exceptions\InvalidArgumentException: "Argument '$id' is invalid: Prefix images not found in original/application/deccb8d2bfc81d6da0df8eb956d83a17.pdf" at /var/www/ezpublish54/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/IO/IOService.php line 386
      

      Steps to reproduce:

      Start from an eZ Publish 5.4 site with eZ Demo frontend.

      1. Add the following twig template at vendor/ezsystems/demobundle/EzSystems/DemoBundle/Resources/views/full/file.html.twig:

      {#
          File (test) - full view
      #}
      
      {% extends "eZDemoBundle::pagelayout.html.twig" %}
      
      {% block content %}
          <h1>File: {{ ez_field_value(content, "file").uri }}</h1>
          <br><a href="{{ ez_field_value(content, "file").uri }}">Link</a>
      {% endblock %}
      

      2. Add the file template definition on vendor/ezsystems/demobundle/EzSystems/DemoBundle/Resources/config/ezdemo.yml after the article template definition:

                      file:
                          controller: "eZDemoBundle:Demo:showArticle"
                          template: "eZDemoBundle:full:file.html.twig"
                          match:
                              Identifier\ContentType: [file]
      

      3. Clear all caches
      4. Login to the administration backend and create a new File content object
      5. Add a .PDF file to it, and publish it
      6. From your eZ Demo frontend access the File content object you just created
      7. Click on the link on page to access to PDF

      You will get a Symfony error as follows:

      Argument '$id' is invalid: Prefix images not found in original/application/deccb8d2bfc81d6da0df8eb956d83a17.pdf
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              ricardo.correia-obsolete@ez.no Ricardo Correia (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: