Improve binary/uri ProfileImage handling#183
Merged
Merged
Conversation
crobibero
approved these changes
Jun 8, 2025
Member
|
Build is fine, just a ci issue since we released rc1 yesterday. |
Accessing `uri.Scheme` throws InvalidOperationException because it's only supported for absolute URIs. This avoids that trap and throws a more friendly error message for unsupported relative URIs.
While some blobs are already detected fine, others were wrongly detected as "valid" URIs resulting in an exception when it realises that's false. This commit avoids false positives by scanning for ASCII control chars, which should also hopefully fix the avatar sync task at the same time.
3f08663 to
69b561a
Compare
Contributor
Author
|
Bumped the bump in readme to save a second bump later (but can drop it if you'd rather include the patch in #182) |
Merged
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.
Problem
Some binary images seem to falsely trip the
TryNew—maybe because it contains a string like567890:hjklmnopqrstuvwxyzin a couple spots—so it throws anInvalidOperationExceptionwhen it gets to theuri.Schemechecks, thus causing both login and the image sync task to fail.Solutions
This PR solves the first issue by scanning for any non-printable ASCII control codes (apart from
\r,\netc.) in thestringValueto avoid the false positive entirely.To solve the second issue for relative paths (or any URI without a scheme), an additional check is added to first ensure the URI is an absolute one. Still an exception, but hopefully much clearer for the user as to what went wrong.