Skip to content

Commit

Permalink
Fix base64 images in notifications
Browse files Browse the repository at this point in the history
Closes openhab#3771

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma committed Jul 20, 2024
1 parent 753c895 commit e143bd5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ sealed class CloudMessage : Parcelable {
if (itemStateFromMedia != null && itemStateFromMedia.toHttpUrlOrNull() == null) {
// media attachment is an item, but item state is not a URL -> interpret as base64 encoded image
return try {
val data = Base64.decode(itemStateFromMedia, Base64.DEFAULT)
val dataString = itemStateFromMedia.substring(itemStateFromMedia.indexOf(",") + 1)
val data = Base64.decode(dataString, Base64.DEFAULT)
BitmapFactory.decodeByteArray(data, 0, data.size)
} catch (e: IllegalArgumentException) {
null
Expand Down

0 comments on commit e143bd5

Please sign in to comment.