Description
Jetpack_Photon::strip_image_dimensions_maybe()
calls file_exists()
without checking if the image is local and should be accessible on the filesystem:
Line 523 in 5cd6e44
If the file_exists()
check is necessary, the method should first check that the image was uploaded to the current WP installation. Even then, it's problematic because it assumes uploads are locally accessible, but that isn't necessarily the case. For sites hosted on distributed hosting platforms that don't store the images locally, sites using a plugin like WP Offload S3 to store media centrally/on a CDN, or sites using Core filters to change upload locations, the check will always fail.
Ideally, the method shouldn't use file_exists()
at all, but if it must, there should be more care given to whether the image can be accessed locally, and the check should be gated by a filter so that users can disable it.
Is there a way to rework the strip_image_dimensions_maybe()
method to work regardless of where the image is hosted?
Introduced to fix #73.