channels: support non-knot text in searches #3274
Merged
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.
On the backend, we were taking the search query directly out of the path. Assuming all paths are well-formed, this meant we had no way of receiving text that didn't fit into the path's
@ta
(aka knot) character limitations.Here, we first try to decode the query part of the search scry path as a knot-encoded string. Only if that fails do we take the path element as-is. (That way, we maintain backwards compatibility, and continue supporting trivial search cases trivially.)
On the frontend, we were injecting the search query into the scry url directly, even if it contained non-url-safe characters. Something further down the stack would url-encode the url string, but the backend wasn't prepared to handle this (and shouldn't have been). Here, we add a "stringToTa()" utility for knot-encoding strings, and make sure to do that to the query before putting it into the url.
With the combination of these, we now support arbitrary text (including unicode!) in the search.
Fixes LAND-1581.