Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(storage): Supabase signed URLs — prepend /storage/v1 (#2565)
FloridaStyle5a295bc29346
diff --git a/src/core/storage/supabase.ts b/src/core/storage/supabase.tsindex ace1fb7f88..ef82d4d75c 100644--- a/src/core/storage/supabase.ts+++ b/src/core/storage/supabase.ts@@ -195,7 +195,14 @@ export class SupabaseStorage implements StorageBackend {throw new Error(`Supabase signed URL failed: ${res.status} ${body}`);}const result = await res.json() as { signedURL: string };- return `${this.projectUrl}${result.signedURL}`;+ // Supabase returns `signedURL` relative to the Storage API root, e.g.+ // "/object/sign/<bucket>/<path>?token=...". Prepend projectUrl + "/storage/v1"+ // (not just projectUrl) or the link 404s. Tolerate an already-absolute URL or a+ // value that already carries the /storage/v1 prefix.+ const signed = result.signedURL;+ if (/^https?:\/\//.test(signed)) return signed;+ if (signed.startsWith('/storage/v1')) return `${this.projectUrl}${signed}`;+ return `${this.projectUrl}/storage/v1${signed.startsWith('/') ? '' : '/'}${signed}`;}async getUrl(path: string): Promise<string> {