Skip to content

Commit 7ce5991

Browse files
committed
internal_link: Escape single quotes in narrow links.
Add single quote (') to the list of characters to be replaced with their dot-encoded equivalents. This fixes an issue where URLs containing single quotes were not correctly parsed across different platforms and messaging clients. Fixes #2105 with the behavior needed for consistent URL detection.
1 parent 3340749 commit 7ce5991

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/model/internal_link.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ const _hashReplacements = {
1414
"(": ".28",
1515
")": ".29",
1616
".": ".2E",
17+
"'": ".27", // Escape single quotes to prevent URL detection issues
1718
};
1819

19-
final _encodeHashComponentRegex = RegExp(r'[%().]');
20+
final _encodeHashComponentRegex = RegExp("[%()'.]");
2021

2122
// Corresponds to encodeHashComponent in Zulip web;
2223
// see web/shared/src/internal_url.ts.

0 commit comments

Comments
 (0)