openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.7k forks source link

[Telegram] Photo URL doesn't allow file:// protocol #5713

Closed mhilbush closed 5 years ago

mhilbush commented 5 years ago

I get an error (invalid base64 image) when trying to send a jpg image that is stored locally on the openHAB filesystem. The URL is defined using the file:// protocol as:

file:///path/to/directory/with/image.jpg

I see that the telegram code only checks that the URL starts with http. Is there a reason why file (or possibly even https) are not allowed? https://github.com/openhab/openhab1-addons/blob/master/bundles/action/org.openhab.action.telegram/src/main/java/org/openhab/action/telegram/internal/Telegram.java#L186

Would you entertain a PR that enables the use of the file:// protocol?

9037568 commented 5 years ago

Well, https should already be allowed, but I agree it would be good to allow file also. If you can confirm the change works, it should be easy to get included.

mhilbush commented 5 years ago

https should already be allowed

Ah, right, because it checks for http... 👍

I run a test using file. If I confirm it works I'll submit a PR. Thanks!

mhilbush commented 5 years ago

Sadly, HttpClient doesn't support the file protocol. Closing this.