about summary refs log tree commit diff
path: root/src/lib/strings/handles.ts
diff options
context:
space:
mode:
authorJoel <joel.garplind@gmail.com>2024-07-08 00:27:30 +0200
committerGitHub <noreply@github.com>2024-07-07 15:27:30 -0700
commitea7afecf28e34b4d1006dc2340630a9f3ea6a9f7 (patch)
treef6b1e635ffec1d7f3a70fe9341436cd480d703d2 /src/lib/strings/handles.ts
parentea37298cdd3dec881a6283eee166b4b508ba12bc (diff)
downloadvoidsky-ea7afecf28e34b4d1006dc2340630a9f3ea6a9f7.tar.zst
Fix misplaced '@' in RTL post meta. (#4531)
Co-authored-by: Joel <joel.garplind+github@gmail.com>
Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/lib/strings/handles.ts')
-rw-r--r--src/lib/strings/handles.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/strings/handles.ts b/src/lib/strings/handles.ts
index bc07b32ec..7955e1b2e 100644
--- a/src/lib/strings/handles.ts
+++ b/src/lib/strings/handles.ts
@@ -1,5 +1,7 @@
 // Regex from the go implementation
 // https://github.com/bluesky-social/indigo/blob/main/atproto/syntax/handle.go#L10
+import {forceLTR} from 'lib/strings/bidi'
+
 const VALIDATE_REGEX =
   /^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/
 
@@ -22,7 +24,9 @@ export function isInvalidHandle(handle: string): boolean {
 }
 
 export function sanitizeHandle(handle: string, prefix = ''): string {
-  return isInvalidHandle(handle) ? '⚠Invalid Handle' : `${prefix}${handle}`
+  return isInvalidHandle(handle)
+    ? '⚠Invalid Handle'
+    : forceLTR(`${prefix}${handle}`)
 }
 
 export interface IsValidHandle {