- Issue created by @recrit
- Merge request !58Issue #3402972: fix file conversion image style support β (Merged) created by recrit
- Status changed to Needs review
about 1 year ago 12:57am 21 November 2023 - πΊπΈUnited States recrit
MR 58 has been opened with the fix for the 2.1.x branch.
Attached is a static patch at commit 28f616d8 for any builds to use. -
recrit β
committed 28f616d8 on 2.1.x
Issue #3402972: fix file conversion image style support
-
recrit β
committed 28f616d8 on 2.1.x
- Status changed to Fixed
12 months ago 5:05pm 27 November 2023 Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
11 months ago 4:02pm 15 December 2023 - πΊπΈUnited States smustgrave
May have to revert this as it caused a regression π Regression - Local files with a dot in their filenames are not correctly served Active if a quick solution can be found over there can leave this in.
- πΊπΈUnited States recrit
@smustgrave the entire patch for this issue may not need reverted. I believe we might just need to revert this line change:
src/EventSubscriber/StageFileProxySubscriber.php: ~ line 190- if ($config->get('use_imagecache_root')) { + if ($config->get('use_imagecache_root') && $unconverted_path === $relative_path) {
- πΊπΈUnited States smustgrave
If I revert that in the other issue, does this one still work for you?
- πΊπΈUnited States recrit
@smustgrave Yes, this issue 3402972 is still fixed with the updates in #8
- π§πͺBelgium herved
Hi @recrit, @smustgrave,
The suggestion in #8 doesn't seem to fix π Regression - Local files with a dot in their filenames are not correctly served Active .
Files with a dot are still "hotlinked" without the extension for me.
E.g: some.image.png?itok=**** > some.image?itok=**** - π³π±Netherlands idebr
This issue adds an additional path to check for all files. All paths that are not available on the origin trigger an exception. As a result, the watchdog is now filled with Stage file proxy exceptions.
- Status changed to Needs work
10 months ago 7:35pm 18 January 2024 - πΊπΈUnited States smustgrave
Since this issue has been merged for 2 months almost, reluctant to fully revert so would like to see if we can find a solution for both.
- πΊπΈUnited States smustgrave
@idebr can you post the error though. Then we can try and figure it out.
- πΊπΈUnited States smustgrave
Also @herved and @idebr does reverting this solve both issues?
- π³π±Netherlands idebr
Stage File Proxy is now pinned to version 2.1.2 for my project to prevent the watchdog spam. A watchdog entry looks like this:
Type stage_file_proxy Date 22 January 2024 - 11:27 User admin Location http://bamaco.localhost/sites/default/files/styles/original_image/public/new800x300.png?itok=D1Gc_UaD&mt= Referrer http://bamaco.localhost/ Message Stage File Proxy encountered an error when retrieving file https://www.uu.nl/sites/default/files/new800x300.png. Client error: `GET https://www.uu.nl/sites/default/files/./new800x300?mt=&itok=D1Gc_UaD` resulted in a `404 Not Found` response: <!DOCTYPE html><html lang="nl" dir="ltr" prefix="og: https://ogp.me/ns#"><head><link rel="preload" as="font" type="font/ (truncated...) in GuzzleHttp\Exception\RequestException::create() (line 113 of /Users/idebraakman/git/uu_bamaco/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php). Severity Error
- πΊπΈUnited States smustgrave
- πΊπΈUnited States smustgrave
Did a release for 2.1.4 with this reverted
I still have this problem with 2.1.4, it is unclear to me if I can do anything about it or not, but here is the error:
Stage File Proxy encountered an error when retrieving file https://www.***.***/sites/default/files/styles/large/public/2024-02/myfi.... Client error: `GET https://www.***.***/sites/default/files/styles/large/public/2024-02/myfi...` resulted in a `404 Not Found` response:
The GET request misses the .png extension of the file.
- πΊπΈUnited States smustgrave
I reverted the change from this ticket as it caused other failures. So this solution may be on track but needs work.
- πΊπΈUnited States recrit
In case anyone is looking for the functionality of this patch, I have attached a patch that works with the latest 2.1.x-dev which still has the method for "getFilePathWithoutConvertedExtension".
- πͺπΈSpain Carlos Romero
Carlos Romero β made their first commit to this issueβs fork.
- πͺπΈSpain Carlos Romero
With 2.1.4 on drupal 10.2 get error when apply the patch, i was updated the 2.1.x branch and reroll the patch
- Status changed to RTBC
6 months ago 1:40pm 14 May 2024 - π΅πΉPortugal saidatom Lisbon
RTBC #24 - https://www.drupal.org/files/issues/2024-03-29/stage_file_proxy-3402972-... β works fine
- Status changed to Needs work
6 months ago 6:31pm 15 May 2024 - π§πͺBelgium herved
This is still causing issues for me.
With both hotlink and use_imagecache_root set to TRUE, and using a file with a dot in its name e.g.: foo.bar.jpg it redirects to foo.bar and wrongly strips the extension (expected is foo.bar.jpg).
You can replicate this with an image field directly with the widget preview (using thumbnail image style which doesn't use any image_convert effect).
Can anyone else confirm this? I'm moving this back to needs work for now.If I understand correctly, there are multiple scenarios depending on hotlink=TRUE/FALSE and use_imagecache_root=TRUE/FALSE.
Also I wonder, why would this be limited to webp? I suspect it is applicable to any image style using the image_convert effect (which can have many more supported extensions like webp, png, jpeg, jpe, gif,..). - Status changed to Postponed: needs info
6 months ago 12:07am 31 May 2024 - πΊπΈUnited States smustgrave
Fix appears to be the same solution posted here π¬ Webp images are not getting generated locally. Active
Can someone test that ticket please.
- π§πͺBelgium herved
#29 still holds true, for me.
I'll crosslink it there. - Status changed to Needs work
6 months ago 2:39pm 31 May 2024 - πΊπΈUnited States smustgrave
Seems still an issue. Closing the other issue as duplicate
- πΊπΈUnited States wylbur Minneapolis, Minnesota, USA
wylbur β changed the visibility of the branch 3402972-2.1.x to hidden.
- π¬π§United Kingdom tonypaulbarker Leeds
#28 worked for me. I do not have the cases described in #29. I think those cases are less common than my case, which is no dots in the filename and converting JPEG to WebP. This issue describes a problem for webp images and I don't think a problem has been reported for other file types. As long as we don't introduce new issues, could we improve this for the majority of cases and then other potential cases be handled on follow up tickets?
- π³π±Netherlands idebr
We can use Core's ImageStyleDownloadController::getUriWithoutConvertedExtension to get the the original file extension. This prevent the issue getting the filename without a dot as reported in #16
- Status changed to Needs review
4 months ago 2:16pm 15 July 2024 - Merge request !78Issue #3402972: Fetching does not respect use_imagecache_root when using... β (Merged) created by idebr
- πΊπΈUnited States smustgrave
Like the approach, would like someone who's been experiencing this issue to mark it though.
- π¬π§United Kingdom justinchev
I was experiencing the issue with the double file extensions, eg. *.jpg.webp.
Applied the patch in #40 to 3.1.0 and it has resolved the issue for me. -
smustgrave β
committed d1f2e645 on 3.1.x authored by
idebr β
Issue #3402972: Fetching does not respect use_imagecache_root when using...
-
smustgrave β
committed d1f2e645 on 3.1.x authored by
idebr β
- Status changed to Fixed
3 months ago 9:18pm 17 August 2024 - πͺπΈSpain Carlos Romero
Hi, I have reverted the commit of in branch 3402972-2.1.4.
The method ImageStyleDownloadController::getUriWithoutConvertedExtension is not present in Drupal version 9.5.x, the 2.x version of stage file proxy is for Drupal 9.x and 10.x.
idebr thanks for the contribution, but this only applies to version 3.x of stage file proxy.Thanks
- π§πͺBelgium herved
Ouch, this is causing a strange intermittent bug where drupal messages (messenger service) are not rendered in some occasions.
When drupal attempts to generate an image style derivative for a local image that contains a dot in its name, e.g.: public://random_66d64a4456c133.73906322.png
I see 2 records in dblog:
- Source image at public://random_66d653fc1a31f4.61396650.png not found while trying to generate derivative image at public://styles/col_lg_2_4x3/public/random_66d653fc1a31f4.61396650.png.
- Stage File Proxy encountered an error when retrieving file https://[prod_domain]/sites/default/files/styles/col_lg_2_4x3/public/random_66d653fc1a31f4.61396650.png. Client error: `GET https://[prod_domain]/sites/default/files/styles/col_lg_2_4x3/public/random_66d653fc1a31f4.61396650?itok=xzHldlkP` resulted in a `404 Not Found` response:
> notice the missing png extension in the request URL.Somehow the messages are registered in
\Drupal\Core\Messenger\Messenger::addMessage
and are present in flashbag but they are not present when retrieved to be printed in\Drupal\Core\Messenger\Messenger::deleteAll
. It looks like the flashbag reference is lost somehow. Maybe because of return new Response() in \Drupal\image\Controller\ImageStyleDownloadController::deliver ? I have no idea...I probably spent a day on this before noticing those errors and suspecting stage_file_proxy :\
Reverting to 3.1.0 or disabling stage_file_proxy fixes it. There is clearly a bug here IMO and it is a really nasty one to debug. Automatically closed - issue fixed for 2 weeks with no activity.
sebastiendaled-rosseel β changed the visibility of the branch 3402972-3.0.x to hidden.
sebastiendaled-rosseel β changed the visibility of the branch 3402972-3.0.x to active.