Replace non-human-readable keys and values with placeholder text#238
Merged
Replace non-human-readable keys and values with placeholder text#238
Conversation
ravjotbrar
reviewed
Mar 10, 2026
apps/server/src/utils.ts
Outdated
| const code = char.charCodeAt(0) | ||
|
|
||
| if ( | ||
| (code >= 32 && code <= 126) // letters, numbers, punctuations |
Collaborator
There was a problem hiding this comment.
Hmm what about unicode?
Contributor
Author
There was a problem hiding this comment.
This implementation only considers ASCII printable characters and doesn't consider any non-english characters.
I'll make the change to fix this.
61955e9 to
b2771ee
Compare
Signed-off-by: Argus Li <contactme@chunkeili.com>
Signed-off-by: Argus Li <contactme@chunkeili.com>
… that. Signed-off-by: Argus Li <contactme@chunkeili.com>
Signed-off-by: Argus Li <contactme@chunkeili.com>
Signed-off-by: Argus Li <contactme@chunkeili.com>
Signed-off-by: Argus Li <contactme@chunkeili.com>
This alternative to elements is displayed if there's a reason why elements cannot be populated. Currently it's only if size is larger than the threshold. Signed-off-by: Argus Li <contactme@chunkeili.com>
Signed-off-by: Argus Li <contactme@chunkeili.com>
Signed-off-by: Argus Li <contactme@chunkeili.com>
5a6b429 to
9b27a92
Compare
arseny-kostenko
previously approved these changes
Mar 10, 2026
Signed-off-by: Argus Li <43020525+ArgusLi@users.noreply.github.com>
arseny-kostenko
approved these changes
Mar 10, 2026
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.
Description
When Valkey stores binary or non-UTF-8 data, the Key Browser can display garbled, non-human-readable strings. This PR detects such content and replaces it with a "Not human readable" message instead.
Human-readability detection
A string is considered human-readable if at least 90% of its characters are printable ASCII (code points 32–126, plus tab, line feed, and carriage return). A ratio-based approach is used instead of a strict all-or-nothing check because some otherwise readable strings can contain stray non-printable bytes (e.g. a trailing null byte or minor encoding artifact). The 90% threshold cleanly separates "mostly text" content from truly binary data, which typically has a printable ratio well below 50%.
Change Visualization