Dynamic routes in image styles break under pathologic

Created on 4 May 2016, over 8 years ago
Updated 13 May 2024, 5 months ago

I have found that routes with dynamic paths through path processing are breaking under pathologic. For example, image styles.

The way these work is that a route is registered on a subfolder the public files directory path, then a path processor translates the trailing directory/filename into a query parameter which is in turn grabbed by the route controller. This is so that the subdirectory can have unlimited depth in the tree and still work.

For example:
My image style route is registered at /sites/default/files/styles/{image_style}/{scheme}
My image style url is /sites/default/files/styles/thumbnail/public/2016-05/myimage.jpg

When pathologic translates this url, the line:

$url = Url::fromUri('internal:/' . $url_params['path'], $url_params['options'])->toString();
returns:
/sites/default/files/styles/thumbnail/public

I'm assuming this is because that is the path that the actual route is registered on.

An easy solution would be to allow pathologic configuration to ignore paths. I actually found this bug when implementing a similar mechanism for caching external images.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia acbramley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024