Skip to content

gitflarePublicPartly agent-ready50

cf-r2-drop

Drag-and-drop file sharing on Cloudflare R2: multipart uploads, expiring share links, previews, download counts, lifecycle expiry.

main
Serve the share page from the extensionless asset path0e4544f
TypeScript13 lines602 B
import { it, expect, vi } from "vitest";vi.mock("cloudflare:workers", () => ({ DurableObject: class {} }));import worker from "../src/index"; it("never requests .html from ASSETS for pretty routes", async () => {  const seen: string[] = [];  const env: any = { ASSETS: { fetch: async (r: Request) => { seen.push(new URL(r.url).pathname); return new Response("shell"); } } };  const res = await (worker.fetch as any)(new Request("https://x.test/s/abc.def"), env);  expect(res.status).toBe(200);  expect(seen).toEqual(["/share"]);  expect(seen.some((p) => p.endsWith(".html"))).toBe(false);});