The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep hostless URL directives raw
Denis H7a72579a739a
diff --git a/apps/desktop/src/components/chat/shiki-highlighter.test.ts b/apps/desktop/src/components/chat/shiki-highlighter.test.tsindex 19938b52705..15629ffe23a 100644--- a/apps/desktop/src/components/chat/shiki-highlighter.test.ts+++ b/apps/desktop/src/components/chat/shiki-highlighter.test.ts@@ -53,6 +53,14 @@ second @url:"https://two.example" @file:\`src/app.ts\``expect(copyableCodeText(code)).toBe('first https://one.example\nsecond https://two.example @file:`src/app.ts`')})+ it('keeps hostless HTTP(S) URL directives raw', () => {+ const http = '@url:http://'+ const https = '@url:https://'++ expect(copyableCodeText(http)).toBe(http)+ expect(copyableCodeText(https)).toBe(https)+ })+it('leaves invalid URL directives and other reference kinds unchanged', () => {const code = '@url:ftp://example.com @url:example.com @image:https://example.com/image.png'diff --git a/apps/desktop/src/components/chat/shiki-highlighter.tsx b/apps/desktop/src/components/chat/shiki-highlighter.tsxindex 48248f7c5dc..2a3088c09d9 100644--- a/apps/desktop/src/components/chat/shiki-highlighter.tsx+++ b/apps/desktop/src/components/chat/shiki-highlighter.tsx@@ -126,7 +126,8 @@ const PlainCode: FC<{ code: string }> = ({ code }) => {)}-const URL_REFERENCE_VALUE_RE = /^https?:\/\/\S+$/i+// Keep code literals such as `@url:http://` raw: a copyable URL needs a host.+const URL_REFERENCE_VALUE_RE = /^https?:\/\/[^/\s]\S*$/i/** Convert URL references back to literal URLs for code-block clipboard text. */export function copyableCodeText(code: string): string {