yireo / Yireo_NextGenImages

45 stars 29 forks source link

Regression following 0.3.6 #60

Closed Amadeco closed 1 year ago

Amadeco commented 1 year ago

Commit reference : 665e4f442e7c3893b02353580d44056cfce70479

Good afternoon,

Following version 0.3.6, the script is not working anymore on full https website (with redirection enabled on web server level).

Indeed, function normalizeUrl rewrites all URL submitted with http instead of https. When you call the config value through :

$storeBaseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB);
$storeMediaUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_MEDIA);
$staticUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_STATIC);

in UrlConvertor class, it could definitively contain https string in it.

And so, when you do the test with strpos it will always return false, so the entire extension will be disabled without any kind of error message.

I think the best way to support // link in my opinion is to do a check with _parseurl php function using scheme returning value test, and reconstruct the url with the correct scheme depending where it was called.

For now, this quick fix is working on a production website with https only.

Ilan

jissereitsma commented 1 year ago

Thanks for posting this. Indeed I'm noticing the same since the last release. Your fix is kind of okay, but I decided to redo the entire concept of normalization in the utility class, which cleans up things quite a bit. A new version 0.3.19 is underway to fix this.

jissereitsma commented 1 year ago

Version 0.4.0 has now been released with a fix on board for this issue.