fix: chat accepts quotes now

This commit is contained in:
gosangam
2026-08-29 11:58:33 +05:30
parent 028a8d7e1c
commit 76cd106ef7
11 changed files with 559 additions and 41 deletions
+12
View File
@@ -303,6 +303,18 @@ export function buildSearchResultUrl(
/**
* Build the full URL with highlight fragment for the selected text.
*/
/**
* The highlight link as an app-relative path ("/books/bg/2/13?hl=…").
*
* Chat quotes store a path rather than a full URL: the BFF refuses absolute
* links there, since a quote renders as trusted in-app content and must not be
* able to carry the reader off-site.
*/
export function buildHighlightPath(selectedText: string): string {
const url = new URL(buildHighlightUrl(selectedText));
return url.pathname + url.search + url.hash;
}
export function buildHighlightUrl(selectedText: string): string {
const fragment = encodeTextFragment(selectedText);
if (!fragment) return window.location.href;