Skip to content

Commit

Permalink
refactor: narrow character range
Browse files Browse the repository at this point in the history
  • Loading branch information
rygine committed Nov 29, 2023
1 parent 9e6bbff commit d22918d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export const buildUserPrivateStoreTopic = (addrPrefixedKey: string): string => {
return buildContentTopic(`privatestore-${addrPrefixedKey}`)
}

// validate that a topic only contains ASCII characters
// validate that a topic only contains ASCII characters 33-127
export const isValidTopic = (topic: string): boolean => {
// eslint-disable-next-line no-control-regex
const regex = /^[\x00-\x7F]+$/
const regex = /^[\x21-\x7F]+$/
const index = topic.indexOf('0/')
if (index !== -1) {
const unwrappedTopic = topic.substring(
Expand Down

0 comments on commit d22918d

Please sign in to comment.