{"draft":null,"from":14,"to":15,"files":[{"path":"client/test/attach.test.ts","added":20,"removed":0,"diff":"--- a/client/test/attach.test.ts\n+++ b/client/test/attach.test.ts\n@@ -31,6 +31,9 @@\n \t\t\tconst body = Buffer.concat(parts);\n \t\t\tseen.push({ method: req.method!, url: req.url!, headers: req.headers, body });\n \t\t\tconst json = (o: unknown) => res.writeHead(200, { \"content-type\": \"application/json\" }).end(JSON.stringify(o));\n+\t\t\t// A server from before attachments: it reads every POST body as JSON.\n+\t\t\tif (req.url!.includes(\"/p/old\") && req.url!.endsWith(\"/attachments\"))\n+\t\t\t\treturn res.writeHead(400, { \"content-type\": \"application/json\" }).end('{\"error\":\"the body is JSON\"}');\n \t\t\tif (req.url!.endsWith(\"/attachments\"))\n \t\t\t\treturn json({\n \t\t\t\t\tid: `a${String(seen.length).padStart(12, \"0\")}`,\n@@ -113,6 +116,23 @@\n \t\tassert.match(alone.out, /--attach goes with avcs issue new or --comment/);\n \t});\n \n+\tit(\"says plainly when the server doesn't take attachments yet, and writes nothing\", async () => {\n+\t\tconst dir = mkdtempSync(join(tmpdir(), \"abso-attach-\"));\n+\t\tdirs.push(dir);\n+\t\tconst init = await avcs(dir, [\"init\", \"--server\", fake.url, \"--project\", \"old\", \"--agent\", \"ann\"]);\n+\t\tassert.equal(init.exit, 0, init.out);\n+\t\twriteFileSync(join(dir, \"shot.png\"), Buffer.from([0x89, 0x50, 0x4e, 0x47, 1]));\n+\t\tconst from = seen.length;\n+\t\tconst r = await avcs(dir, [\"issue\", \"new\", \"T\", \"--attach\", \"shot.png\"]);\n+\t\tassert.equal(r.exit, 1);\n+\t\tassert.match(r.out, /doesn't take attachments yet, so shot.png wasn't sent and nothing was written/);\n+\t\tassert.deepEqual(\n+\t\t\tseen.slice(from).map((c) => c.url.replace(/^\\/p\\/[^/]+/, \"\")),\n+\t\t\t[\"/a/ann/attachments\"],\n+\t\t\t\"no issue was opened\",\n+\t\t);\n+\t});\n+\n \tit(\"sends nothing when a file is missing\", async () => {\n \t\tconst dir = await folder();\n \t\tconst from = seen.length;"}],"unmatched":[]}