Do not fail a ZeroZero delivery when the account cannot publish.
ci / rust (pull_request) Successful in 4m10s
ci / typescript (pull_request) Successful in 11m13s

A photographer login may upload and still get 403 on photo-sync. The file is already on the desk, so that refusal is not a failed delivery.
This commit is contained in:
spark committed 2026-11-26 22:07:12 +00:00
1 parent 63b021cec8
commit 56c115933c
3 files changed
+8 -9

No files matched your search

+3 -8
View File
@@ -123,21 +123,16 @@ describe("zerozero publish", () => {
expect((err as TransportError).transient).toBe(true);
});
it("does not retry when neither publish route accepts the account", async () => {
it("keeps the upload when the account is not allowed to publish", async () => {
const calls: string[] = [];
const client = new ZerozeroClient(
{ username: "kapta", password: "zz-pass" },
desk((pathname) => {
calls.push(pathname);
return Response.json({ error: "forbidden" }, { status: 403 });
return Response.json({ error: "Insufficient permissions" }, { status: 403 });
}),
);
const err = await client.publish("12627743", "img-9").then(
() => null,
(error: unknown) => error,
);
expect(err).toBeInstanceOf(TransportError);
expect((err as TransportError).transient).toBe(false);
await client.publish("12627743", "img-9");
expect(calls).toEqual(["/api/photo-sync/img-9", "/api/photo-sync/match/12627743"]);
});
});
+3
View File
@@ -283,6 +283,9 @@ export class ZerozeroClient {
}
}
const match = await this.postApi(`/photo-sync/match/${encodeURIComponent(gameId)}`, PUBLISH_TIMEOUT_MS);
// A photographer account may upload but not publish ("Insufficient permissions"). The file is already on
// the desk; failing the delivery here only blocks the queue. The desk publishes those itself.
if (match.status === 403) return;
const ours = placeholder ? null : imageId;
this.assertPublished(match, ours);
}
+2 -1
View File
@@ -477,7 +477,8 @@ The same queue also delivers to SFTP, FTP/FTPS and Dropbox (`delivery/transports
author (`artist`: the photographer's name from the IPTC creator). The upload only reaches the photographer's
desk. The public game shows the photo after publish: `POST /api/photo-sync/<image id>`, or
`POST /api/photo-sync/match/<game>` when the desk has no single-image publish (the same call as
"Sincronizar com zerozero"). A delivery is done only after that call succeeds. The "folder" is the game:
"Sincronizar com zerozero"). A photographer account that is refused (403) still counts as delivered: the file
is on the desk, and that account cannot publish. Any other publish failure fails the delivery. The "folder" is the game:
chosen for the event by pasting the game's link (kept in `events.zerozero_game_id`), or found among the desk's
upcoming games by both teams and kick-off within 3 hours. The delivered item's remote path is `<game>/<image id>`
(`DELETE /api/images/<id>` takes it back).