Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getBrowserPath returns cached URL for type that was not requested #1526

Open
wouterSkepp opened this issue Aug 28, 2023 · 1 comment
Open

Comments

@wouterSkepp
Copy link

wouterSkepp commented Aug 28, 2023

The CacheManager::getBrowserPath returns a path or url for a previously cached asset. However, the parameter for the URL generator is not within scope of the caching mechanism, possibly returning unexpected results.

Preconditions

LiipImagineBundle 2.x

Steps to reproduce

Create a template that exposes an asset through multiple variations of the UrlGeneratorInterface types (e.g. absolute url, absolute path)

<img src="{{ 'cats.jpg'|imagine_filter('my_thumb', {}, null, constant('Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface::ABSOLUTE_URL')) }}" alt="Absolute"/>
<img src="{{ 'cats.jpg'|imagine_filter('my_thumb', {}, null, constant('Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface::ABSOLUTE_PATH')) }}" alt="Path"/>

Expected result

I expect the template to render as follows:

<img src="http://example.com/media/cache/my_thumb/cats.jpg" alt="Absolute"/>
<img src="/media/cache/my_thumb/cats.jpg" alt="Path"/>

Actual result

<img src="http://example.com/media/cache/my_thumb/cats.jpg" alt="Absolute"/>
<img src="http://example.com/media/cache/my_thumb/cats.jpg" alt="Path"/>

This is happening because CacheManager::getBrowserPath returns ResolverInterface::resolve(), which does not have the referenceType as a parameter.

@ytilotti
Copy link

ytilotti commented Mar 17, 2024

Same issue here. Real problem to addPart on email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants