-
-
Notifications
You must be signed in to change notification settings - Fork 19
Description
We use Tachyon for image scaling and this will sometimes add parameters to the image, something like image.webp?resize=10x10
.
In the admin site, we found the image was sometimes not displayed after upgrading to a newer node version of the plugin. After some debugging it was found that the url being created in the render_field()
method in this plugin was just adding ?v=_hash_
to the end of the url giving a url of image.webp?resize=10x10?v=_hash_
. If you take the url and paste it into a browser it fails to load, change the second ? to an & and the image loads. This is down to the second ? being treated as part of the previous parameter rather than as a separate one (according to https://stackoverflow.com/questions/2924160/is-it-valid-to-have-more-than-one-question-mark-in-a-url)
I would think that a simple fix would be to change to code to check for a ? before just appending the v parameter and this should solve the problem and also ensure it's added correctly. Something along the lines of
// url exists
if ($url) {
$url = $url[0] . (strpos($url[0], '?') === false ? '?v=' : '&v=') . md5(get_the_date($image_id));
}
If I create a PR and add this, is this likely to be added soonish, or should I create a temporary work around to keep the sites working properly.
Thanks
Nigel