Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

fix(web): restore image annotation on new and existing issues (#407)

Croff63c41cd2aee6
diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts
index 677a4633..cc696433 100644
--- a/apps/web/next.config.ts
+++ b/apps/web/next.config.ts
@@ -43,6 +43,10 @@ const nextConfig: NextConfig = {
// next dev otherwise appends a block of its own to apps/web/AGENTS.md on every
// start, which leaves the working tree dirty for anyone running the dev server.
agentRules: false,
+ // Every local image is served by app/media. Next 16 refuses a query string on
+ // a local image unless its path is listed here; the attachments panel stamps a
+ // replaced attachment's URL with one so the optimizer refetches it.
+ images: { localPatterns: [{ pathname: '/media/**' }] },
...(cloudUiEntry ? { turbopack: { resolveAlias: { '@/cloud': cloudUiEntry } } } : {}),
};
diff --git a/apps/web/src/proxy.test.ts b/apps/web/src/proxy.test.ts
index ac772349..58cb16bf 100644
--- a/apps/web/src/proxy.test.ts
+++ b/apps/web/src/proxy.test.ts
@@ -56,7 +56,7 @@ describe('proxy security headers', () => {
it('serves every page with a content security policy naming the api origin', () => {
process.env.API_URL = 'http://api.test:3000/';
const csp = run('/login').headers.get('content-security-policy');
- assert.match(csp!, /(^|; )connect-src 'self' http:\/\/api\.test:3000(;|$)/);
+ assert.match(csp!, /(^|; )connect-src 'self' blob: http:\/\/api\.test:3000(;|$)/);
assert.match(csp!, /(^|; )frame-ancestors 'none'(;|$)/);
assert.match(csp!, /(^|; )object-src 'none'(;|$)/);
});
diff --git a/apps/web/src/utils/contentSecurityPolicy.test.ts b/apps/web/src/utils/contentSecurityPolicy.test.ts
index 62ba416c..05ce2349 100644
--- a/apps/web/src/utils/contentSecurityPolicy.test.ts
+++ b/apps/web/src/utils/contentSecurityPolicy.test.ts
@@ -16,11 +16,11 @@ afterEach(() => {
describe('contentSecurityPolicy', () => {
it('allows requests to the api origin only, without its path', () => {
process.env.API_URL = 'https://api.example.com/base/';
- assert.match(contentSecurityPolicy(), /connect-src 'self' https:\/\/api\.example\.com;/);
+ assert.match(contentSecurityPolicy(), /connect-src 'self' blob: https:\/\/api\.example\.com;/);
});
it('falls back to same-origin requests when the api url is not absolute', () => {
process.env.API_URL = 'not a url';
- assert.match(contentSecurityPolicy(), /connect-src 'self';/);
+ assert.match(contentSecurityPolicy(), /connect-src 'self' blob:;/);
});
});
diff --git a/apps/web/src/utils/contentSecurityPolicy.ts b/apps/web/src/utils/contentSecurityPolicy.ts
index 2d988b04..c4082a41 100644
--- a/apps/web/src/utils/contentSecurityPolicy.ts
+++ b/apps/web/src/utils/contentSecurityPolicy.ts
@@ -16,8 +16,9 @@ function apiOrigin(): string {
// and RuntimeEnvScript are inline and carry no nonce. A nonce policy is the step
// after this one. Inline styles are what tiptap, Radix, recharts and Scalar emit.
// Images and media come from anywhere: markdown embeds by URL, OAuth profile
-// pictures, and the /media proxy on this origin. React evals in development only,
-// to rebuild server error stacks in the browser.
+// pictures, and the /media proxy on this origin. blob: is fetched too: the image
+// annotator reads a file picked in the new issue modal through its blob: URL. React
+// evals in development only, to rebuild server error stacks in the browser.
export function contentSecurityPolicy(): string {
const scriptSources =
process.env.NODE_ENV === 'development'
@@ -30,7 +31,7 @@ export function contentSecurityPolicy(): string {
"img-src 'self' data: blob: https: http:",
"media-src 'self' data: blob: https: http:",
"font-src 'self' data:",
- `connect-src 'self' ${apiOrigin()}`.trimEnd(),
+ `connect-src 'self' blob: ${apiOrigin()}`.trimEnd(),
"object-src 'none'",
"base-uri 'self'",
"form-action 'self'",