AppView in a box as a Vite plugin thing hatk.dev
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: add 401 redirect to blob upload client path

The generated callXrpc client handled 401 responses with a redirect to
re-auth for procedures and queries, but the blob upload path was
missing this handler — causing raw errors instead of graceful re-auth.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+2 -1
+1 -1
packages/hatk/package.json
··· 1 1 { 2 2 "name": "@hatk/hatk", 3 - "version": "0.0.1-alpha.43", 3 + "version": "0.0.1-alpha.44", 4 4 "license": "MIT", 5 5 "bin": { 6 6 "hatk": "dist/cli.js"
+1
packages/hatk/src/cli.ts
··· 1201 1201 clientOut += ` const blob = arg as Blob | ArrayBuffer\n` 1202 1202 clientOut += ` const ct = blob instanceof Blob ? blob.type : 'application/octet-stream'\n` 1203 1203 clientOut += ` const res = await _fetch(path, { method: 'POST', headers: { 'Content-Type': ct }, body: blob })\n` 1204 + clientOut += ` if (typeof window !== 'undefined' && res.status === 401) { const _b = await res.json().catch(() => ({})); const _h = _b.handle ?? getViewer()?.handle; window.location.href = _h ? \`/oauth/login?handle=\${encodeURIComponent(_h)}\` : '/oauth/login'; return new Promise(() => {}) as any }\n` 1204 1205 clientOut += ` if (!res.ok) throw new Error(\`XRPC \${nsid} failed: \${res.status}\`)\n` 1205 1206 clientOut += ` return res.json() as Promise<OutputOf<K>>\n` 1206 1207 clientOut += ` }\n`