Fix Discord details url exceeding max length#1620
Merged
jeffvli merged 2 commits intojeffvli:developmentfrom Jan 29, 2026
Merged
Fix Discord details url exceeding max length#1620jeffvli merged 2 commits intojeffvli:developmentfrom
jeffvli merged 2 commits intojeffvli:developmentfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
Doing the same thing for Musicbrainz links didn't seem necessary in hindsight, as their IDs are limited in length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Discord integration currently breaks for titles with very long non-Unicode names, such as the song
お勉強しといてよbyずっと真夜中でいいのに。on the album朗らかな皮膚とて不服 [初回生産限定盤]. The URI encoding of those Japanese characters results in URLs that are too long for Discord to handle (1). As a result, the activity isn't being displayed for those songs.Since I don't think it's possible to work around the limitation, I believe it's best to only set the details URL if it doesn't exceed Discord's limit of 256 characters. The PR is one potential implementation of that fix. It might be worth logging when the URLs aren't being applied to prevent potential confusion, but I wasn't sure how logging is best handled in this project.
The issue might also apply to other URLs, but the state URL seems a lot shorter in comparison, Musicbrainz links are effectively fixed-length, and the image URLs don't seem to be affected by this from what I can tell.
(1) the link for that song is https://www.last.fm/music/%E3%81%9A%E3%81%A3%E3%81%A8%E7%9C%9F%E5%A4%9C%E4%B8%AD%E3%81%A7%E3%81%84%E3%81%84%E3%81%AE%E3%81%AB%E3%80%82/%E6%9C%97%E3%82%89%E3%81%8B%E3%81%AA%E7%9A%AE%E8%86%9A%E3%81%A8%E3%81%A6%E4%B8%8D%E6%9C%8D%20%5B%E5%88%9D%E5%9B%9E%E7%94%9F%E7%94%A3%E9%99%90%E5%AE%9A%E7%9B%A4%5D/%E3%81%8A%E5%8B%89%E5%BC%B7%E3%81%97%E3%81%A8%E3%81%84%E3%81%A6%E3%82%88 (370 characters)