fix(write): let conflict:// writes reach the resolver
- Exempted the handler-less conflict:// scheme from the URI-like guard so parseConflictUri still splices registered blocks. - Extended the near-miss regression to assert conflict://1 reaches the resolver. Fixes #6123
This commit is contained in:
@@ -104,6 +104,9 @@ function assertWriteTargetAddressable(target: string, router: InternalUrlRouter)
|
||||
if (!uriLike) return;
|
||||
|
||||
const scheme = uriLike[1]!.toLowerCase();
|
||||
// conflict:// has no router handler but is spliced downstream by
|
||||
// parseConflictUri (which emits its own precise id/scope errors); let it pass.
|
||||
if (scheme === "conflict") return;
|
||||
const canonicalScheme = router.getHandler(scheme) ? scheme : XD_SCHEME_NEAR_MISSES[scheme] ? "xd" : undefined;
|
||||
const suggestion = canonicalScheme
|
||||
? ` Did you mean '${canonicalScheme}://${uriLike[2]}'?`
|
||||
|
||||
@@ -107,6 +107,12 @@ describe("read and write route xd:// device URLs", () => {
|
||||
});
|
||||
expect(escaped.isError).toBeUndefined();
|
||||
expect(await Bun.file(path.join(tempDir, "xd/web_search")).text()).toBe("intentional file");
|
||||
|
||||
// conflict:// has no router handler but is a documented write scheme —
|
||||
// the guard must let it reach the conflict resolver, not reject it.
|
||||
await expect(write!.execute("write-conflict", { path: "conflict://1", content: "x" })).rejects.toThrow(
|
||||
"Conflict #1 not found",
|
||||
);
|
||||
} finally {
|
||||
await removeWithRetries(tempDir);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user