From 1e5ebaa19c427adb68f3efa52eb5a9b521064132 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Wed, 5 Feb 2020 20:18:50 +0100 Subject: limit artist - title in messages to 128 chars --- src/main/java/de/pixart/messenger/persistance/FileBackend.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/de/pixart/messenger/persistance/FileBackend.java') diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index 08dc746c1..babc7f888 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -1182,7 +1182,7 @@ public class FileBackend { } } - private String getAudioTitleArtist(File file) { + private String getAudioTitleArtist(final File file) { String artist; String title; StringBuilder builder = new StringBuilder(); @@ -1210,7 +1210,8 @@ public class FileBackend { builder.append(title); } try { - byte[] data = builder.toString().trim().getBytes("UTF-8"); + final String s = builder.substring(0, Math.min(128, builder.length())); + final byte[] data = s.trim().getBytes("UTF-8"); return Base64.encodeToString(data, Base64.DEFAULT); } catch (UnsupportedEncodingException e) { e.printStackTrace(); -- cgit v1.2.3