shopware / shopware

Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions
https://shopware.com
MIT License
2.81k stars 1.02k forks source link

Handling JSON encoded urls in `SeoUrlPlaceholderHandler` #3087

Open iNaD opened 1 year ago

iNaD commented 1 year ago

PHP Version

8.2

Shopware Version

6.4.20.2

Expected behaviour

A JSON encoded url (e.g. 124c71d524604ccbad6042edce3ac799\/navigation\/729d802d5b8544af874dfcaa4fe9c8c3#) will be replaced correctly with the matching seo url for this navigation element.

Host: http://localhost SEO Url for pathInfo = '/navigation/729d802d5b8544af874dfcaa4fe9c8c3' with seoPathInfo = 'Foo/'

Will result in the url http://localhost/Foo/

Actual behaviour

Rendered url is http://localhost//navigation/729d802d5b8544af874dfcaa4fe9c8c3

How to reproduce

In a Twig Template do the following:

{% set options = {
    url: seoUrl('frontend.navigation.page', { navigationId: navigationId }),
} %}

<div data-foo data-foo-options="{{ options|json_encode }}">
</div>

Only the SEO Url Placeholder for the sales channel host will be replaced, because the path info part is escaped with \/.

A workaround for now is to decorate SeoUrlPlaceholderHandlerInterface::replace and do a $content = str_replace('\/', '/', $content);, but this would probably hurt performance on large contents?

shopware-issue-bot[bot] commented 1 year ago

We found the following existing issues which may help or are related to your topic:

MarcelSchmaeing commented 2 months ago

Hi,

thx for your issue we will put it into our new evaluation process and have a look at it again.

shopwareBot commented 2 months ago

[public] Automated response: This issue is linked to the internal issue https://shopware.atlassian.net/browse/NEXT-37972.

[created from NEXT-37972, comment 489098]