Details
-
Bug
-
Resolution: Unresolved
-
Low
-
1.13.3, 1.7.8, 2.5.3
-
None
Description
Steps to reproduce
- Install clean eZ Platform (1.7/1.13/2.x).
- Edit default Article ContentType and add the new field of type ezbinaryfile.
- Add new language, for instance Norwegian (nor-NO).
- Configure Siteaccesses as following:
siteaccess: list: [nor, eng] groups: site_group: [nor, eng] default_siteaccess: eng match: URIElement: 1 system: nor: languages: [nor-NO] eng: languages: [eng-GB]
- Create new article in eng-GB and attach file, for instance english.pdf.
- Translate content created in the previous step and attach new file, for instance norwegian.pdf.
- Create new frontend template and match it to handle Article ContentType:
{% extends '@EzPublishCore/pagelayout.html.twig' %} {% block content %} {% set fileUri = ez_field_value(content, 'file').uri %} <a href="{{ fileUri }}">Download</a><br /> {% endblock %}
- Open article on the frontend using nor siteaccess and check download link. You should see something like: example.com/nor/content/download/56/288.
- Open article on the frontend using eng siteaccess and check download link. You should see something like: example.com/nor/content/download/56/295.
Actual behavior:
ezbinaryfile uri property always contains the name of the siteaccess which has been used first.
Expected behavior:
ezbinaryfile uri should contain the name of the currently used siteaccess.
Note:
The issue isn't reproducible in v2, due to the fact how ContentProxy loads content, but still, cached uri might be invalid.
Note:
To reproduce the issue in v2 use the following configuration:
site: languages: [eng-GB] content_view: full: file: controller: "AppBundle:Index:main" template: "full/test.html.twig" match: Identifier\ContentType: "file"
and example Controller e.g.
<?php namespace AppBundle\Controller; use eZ\Bundle\EzPublishCoreBundle\Controller; use eZ\Publish\Core\MVC\Symfony\View\ContentView; class IndexController extends Controller { public function mainAction(ContentView $view) { $content = $view->getContent(); /** @var Value $fieldValue */ $fieldValue = $content->getFieldValue('file'); dump($fieldValue); return $this->redirect($fieldValue->uri); } }
After that create a new File content. After publishing it visit it on the frontend SiteAccess. You will be able to download the file, however, URI parameter will contain "admin" prefix, for instance: /admin/content/download/57/265.
After clearing Symfony cache, URI is correct /content/download/57/265. The issue is also reproducible using Redis. In that case, you need to clear Redis cache instead to see proper URI.