Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(markdown): load static-file images directly, not through the proxy (#9202)

gbirman3aa34ada1d16
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index f73e4f7ad2..b973f38a5f 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -409,7 +409,7 @@ resolved session ID; keep the existing `AgentSessionProvider` subscription to
- Keep desktop headers on the shared `ListHeader` / `HeaderActionGroup` pattern: view `Tabs` as pills after the title, `sm`/`icon-sm` semantic islands (28px controls) with 8px gaps on the right, fully rounded frames, New then expandable Search; retain `md` sizing for Tabs, New, and Search. Drive and Tasks list-header filter, layout, sort, and grouping islands use `md`/`icon-md` (32px) to match New and Search. Preserve touch layouts. Compose ButtonGroup actions with explicit `ButtonGroup.Button` segments; use `variant="secondary" finish="raised"` on action frames. Standalone Buttons do not inherit group styling. Pick each control by role from the [design system rule](../../.agents/rules/web/design-system.md); see [UI conventions](../../docs/agent-guide/ui-conventions.md#top-bars). Never use recessed/inset backgrounds in headers.
- Keep desktop model and effort controls separate: the model selector opens the catalog and the speedometer opens the runtime's advertised slider stops; retain the mobile effort sheet.
- Passive PR mentions must not retry initial GitHub status failures on remount; preserve confirmed status through refetch errors and keep pending data reads out of their parent Suspense boundary.
-- PR description and comment images are remote URL images: rewrite GitHub blob/`raw` links to `raw.githubusercontent.com` and load them through the image proxy so COEP does not block github.com.
+- PR description and comment images are remote URL images: rewrite GitHub blob/`raw` links to `raw.githubusercontent.com` and load them through the image proxy so COEP does not block github.com. Load Macro's own static-file URLs directly: a composer image reaches the server as Markdown and comes back as a URL image, and the proxy needs a session cookie that a `crossorigin="anonymous"` image never sends.
- Keep native booking exit navigation in the route shell, outside page loading boundaries, and use the router so the native hash route stays intact.
- Diagnose native full reloads with `native_webview_started`, `native_diagnostic_recovered`, and the shared `frontend_instance_id`; use `reloadApp(reason)` for frontend reloads and keep breadcrumbs content-free. Treat `previous_document_*` checkpoints as last-observed lifecycle evidence, never a crash verdict; clear them on logout. `previous_document_last_*` comes from the native navigation breadcrumb (route and entity type, never ids). See [frontend checkpoints](docs/native-reload-diagnostics.md) and `tauri/src-tauri/README.md`.
- Pass `$APPLOCALDATA` (Application Support on Apple platforms) as the native HTTP cookie storage directory; the plugin owns the `.cookies` filename. Never use purgeable caches. The location change intentionally requires one new sign-in, without migration. See `tauri/src-tauri/README.md#native-authentication-cookies`.
diff --git a/apps/web/src/lib/core/util/imageProxy.test.ts b/apps/web/src/lib/core/util/imageProxy.test.ts
index b3055002a3..14daa47e72 100644
--- a/apps/web/src/lib/core/util/imageProxy.test.ts
+++ b/apps/web/src/lib/core/util/imageProxy.test.ts
@@ -48,6 +48,18 @@ describe('displayImageUrl', () => {
);
});
+ it('loads a static file directly instead of through the proxy', () => {
+ const src = `${SERVER_HOSTS['static-file']}/file/299c189c-df42-4a9a-b42b-7220264b607b`;
+ expect(displayImageUrl(src)).toBe(src);
+ });
+
+ it('proxies a host that only begins like the static file host', () => {
+ const src = `${SERVER_HOSTS['static-file']}.example.com/shot.png`;
+ expect(displayImageUrl(src)).toBe(
+ `${SERVER_HOSTS['image-proxy-service']}/proxy?url=${encodeURIComponent(src)}`
+ );
+ });
+
it('leaves data URLs unchanged', () => {
expect(proxyImageUrl('data:image/png;base64,AAAA')).toBe(
'data:image/png;base64,AAAA'
diff --git a/apps/web/src/lib/core/util/imageProxy.ts b/apps/web/src/lib/core/util/imageProxy.ts
index 9ff39dc001..1afcaec764 100644
--- a/apps/web/src/lib/core/util/imageProxy.ts
+++ b/apps/web/src/lib/core/util/imageProxy.ts
@@ -48,5 +48,9 @@ export function proxyImageUrl(src: string): string {
/** URL to put on an `<img>` for a remote markdown image. */
export function displayImageUrl(src: string): string {
+ // Markdown import turns a pasted image into a plain URL. Static files are
+ // public and send their own CORS headers, while the proxy needs a session
+ // cookie that a `crossorigin="anonymous"` image never sends.
+ if (src.startsWith(`${SERVER_HOSTS['static-file']}/`)) return src;
return proxyImageUrl(githubRawImageUrl(src));
}