yireo / Yireo_NextGenImages

44 stars 26 forks source link

Preg_match fix in isLocal function #11

Closed Quazz closed 3 years ago

Quazz commented 3 years ago

Just a small thing, but can cause issues for certain urls.

https://github.com/yireo/Yireo_NextGenImages/blob/master/Image/UrlConvertor.php#L51

preg_match returns false only in the case of an error.

preg_match returns 0 in case it does not match (I think this is the intended behavior)

Before:

magento next-gen-images:convert /pathtomagento2/pub/media/catalog/product/s/v/sv565utpduv.jpg

In UrlConvertor.php line 77:

  URL "/pathtomagento2/pub/media/catalog/product/s/v/sv565utpduv.webp" does not appear to be a local file

next-gen-images:convert <image>

After:

magento next-gen-images:convert /pathtomagento2/pub/media/catalog/product/s/v/sv565utpduv.jpg
Converted image: /pathtomagento2/pub/media/catalog/product/s/v/sv565utpduv.jpg
jissereitsma commented 3 years ago

@Quazz Thanks. Indeed this seems a typo. I will include this in the next build. Please note that exactly for little things like this, GitHub has made it issue for you to: Open up a file in GitHub while in your browser, make a change, fork & create a pull request based on this change. It is more efficient that way. Just for future reference.

Thanks for your help anyway.