Do not fail a ZeroZero delivery when the account cannot publish.
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:
1 parent
63b021cec8
commit
56c115933c
3 files changed
+8
-9
No files matched your search
@@ -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"]);
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in new issue
Block a user