seregazhuk / php-pinterest-bot

This PHP library will help you to work with your Pinterest account without using any API account credentials.
MIT License
416 stars 129 forks source link

Upload from non ASCII links doesn't work #435

Closed seregazhuk closed 5 years ago

seregazhuk commented 5 years ago

It fails when trying to upload a link that contains non-ASCII characters. For example:

$res = $bot->pins->create('https://wpapers.ru/wallpapers/animals/Cats/8651/PREV_Котик.jpg', $boardId, 'test');

The reason is that filter_var($imageUrl, FILTER_VALIDATE_URL) doesn't work with such strings. To fix it we can use file_exists() to check whether we should upload a local file or a link.