Fix deep link installation for mods containing + (plus sign)#6464
Open
mfishma wants to merge 3 commits into
Open
Fix deep link installation for mods containing + (plus sign)#6464mfishma wants to merge 3 commits into
mfishma wants to merge 3 commits into
Conversation
Member
Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
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.
Fixes #6295
Summary
I was having issues where deeplinks to projects that have
+in the name (likemodrinth://mod/vb+) were breaking the app. It was a problem because that's the best way to have an app load an Unlisted project. The other option being the ID, but that wasn't safe to have people trust this random string of characters.As is usually the case with "+", there was a problem with URL-encoding. The app wasn't encoding the
+sign before asking the API for the mod data. So then the backend thinks the+is a space (it searches for"vb "instead of"vb+".) Since the mod with a space at the end doesn't exist, it returned nothing, and the app threw a cryptic project_type-is-null error.Changes
cache.rsUpdated the URL builder to useurl::form_urlencoded::byte_serialize(). This encodes the project ID (per RFC 3986) so the+actually makes it to the server correctly.content-install.tsI added a quick safety check. If a project fails to load (like if the link is a typo or missing), it now just shows a normal "Project not found" error instead of breaking the UI. And I put quotes around the ID in the error message so it's easier to spot accidental trailing spaces later.Hope this helps! Let me know if you need me to change anything.