diff options
| author | Samantaz Fox <coding@samantaz.fr> | 2024-10-08 18:01:22 +0200 |
|---|---|---|
| committer | Samantaz Fox <coding@samantaz.fr> | 2024-10-08 18:01:22 +0200 |
| commit | 97895a491a1c724dee68f3f47f7ad25a26dfcaaf (patch) | |
| tree | 90e16d080b72d063c5a0dc707725023d989d3f1b | |
| parent | 0ac93673226911dc11eb5be19230e6dccf8c5e1b (diff) | |
| parent | bd34659ff60bd049a2503f2d5e59d353d01840d8 (diff) | |
| download | invidious-97895a491a1c724dee68f3f47f7ad25a26dfcaaf.tar.gz invidious-97895a491a1c724dee68f3f47f7ad25a26dfcaaf.tar.bz2 invidious-97895a491a1c724dee68f3f47f7ad25a26dfcaaf.zip | |
Playlists: Fix 'invalid byte sequence' error when subscribing (#4887)
In Crystal, handling multi-byte sequences in UTF-8 requires understanding that
slicing by bytes can lead to invalid sequences if the slicing isn't aligned
with character boundaries. In this case, attempting to slice a string by bytes
can cut through multi-byte UTF-8 sequences, leading to invalid sequences.
To avoid this, strings should be sliced based on characters rather than bytes.
Fixes issue 4886
| -rw-r--r-- | src/invidious/playlists.cr | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 3e6eef95..a51e88b4 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -270,7 +270,7 @@ end def subscribe_playlist(user, playlist) playlist = InvidiousPlaylist.new({ - title: playlist.title.byte_slice(0, 150), + title: playlist.title[..150], id: playlist.id, author: user.email, description: "", # Max 5000 characters |
