import { davError, emptyResponse } from "@/worker/dav/http"; import { normalizeFilesPath } from "@/worker/dav/paths"; import type { FileDavError, FileDavObject } from "@/worker/objects/file-dav-object"; export type NormalizedFilesRequestPath = ReturnType & { ok: true }; export function fileDavObject(env: Env, storageId: string): DurableObjectStub { return env.FILE_DAV.getByName(storageId); } export function resultError(result: FileDavError): Response { if (result.status === 304) return emptyResponse(304); return davError(result.status, result.message); }