mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
hash: Use encoding for slugs in dm narrow hashes.
Slugs in dm urls aren't really passed through url decoding and shouldn't throw any error currently if hashReplacement aren't enforced. But we still encode them in this commit to make this consistent.
This commit is contained in:
committed by
Tim Abbott
parent
f86654ba5f
commit
152ad3bf3d
@@ -2,6 +2,7 @@ import md5 from "blueimp-md5";
|
||||
import assert from "minimalistic-assert";
|
||||
import * as z from "zod/mini";
|
||||
|
||||
import * as internal_url from "../shared/src/internal_url.ts";
|
||||
import * as typeahead from "../shared/src/typeahead.ts";
|
||||
|
||||
import * as blueslip from "./blueslip.ts";
|
||||
@@ -650,7 +651,7 @@ export function pm_perma_link(message: Message): string | undefined {
|
||||
}
|
||||
|
||||
export function get_slug_from_full_name(full_name: string): string {
|
||||
return full_name.replaceAll(/[ "%/<>`\p{C}]+/gu, "-");
|
||||
return internal_url.encodeHashComponent(full_name.replaceAll(/[ "%/<>`\p{C}]+/gu, "-"));
|
||||
}
|
||||
|
||||
export function pm_with_url(message: Message | MessageWithBooleans): string | undefined {
|
||||
|
||||
Reference in New Issue
Block a user