Problem/Motivation

With hotlink on and use_imagecache_root off, a file whose name has another
dot redirects to the origin without its extension. e.g. /sites/default/files/banner_v2.6.jpg redirects to https://origin.example.com/sites/default/files/banner_v2.6

StageFileProxySubscriber passes every path, not only image style derivatives, to ImageStyleDownloadController::getUriWithoutConvertedExtension(), which strips the ".jpg" because "banner_v2.6" still looks like it has an extension.

The same happens to a converted derivative (styles/large/public/foo.jpg.webp redirects without the .webp extension).

Steps to reproduce

1. Set origin, hotlink: true, use_imagecache_root: false.
2. Request /sites/default/files/banner_v2.6.jpg (not present locally).
3. The Location header ends in "banner_v2.6".

Proposed resolution

Only look for a converted extension on image style derivatives. and when hotlinking, redirect to the requested path and stop, this should let the origin generate the derivatives itself.

Remaining tasks

Provide MR.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

codebymikey created an issue. See original summary.

codebymikey’s picture

Version: 3.1.x-dev » 4.0.x-dev
Issue summary: View changes
Status: Active » Needs review
Related issues: +#3402972: Fetching does not respect use_imagecache_root when using converted webp image styles
smustgrave’s picture

Status: Needs review » Needs work

Can the MR be updated for 4.0.x? Or new MR opened

codebymikey’s picture

Added the 4.0.x MR, and ran test-only pipeline to showcase the bug on both 3.1.x and 4.0.x - #3543794: stage_file_proxy use_imagecache_root TRUE breaks image style generation for filenames containing dots fixes some of the use cases with an explicit extension list, so there are less failures on 4.0.x, but doesn't fully cover the webp scenario properly.