fix(android): a conflict answers 422, not 409

The retry path finally ran, and did not recognise what it was handed. A
desktop publishing between our read and our write earns a 422, not a 409, so
the save failed instead of retrying - which is exactly what a never-exercised
path hides: it was written, it compiled, it was even commented, and it did
not fire.

Gitea answers 409 when the sha no longer matches and 422 when it is missing
or the request is judged unprocessable, "file already exists" among them.
Both say the same thing to us: the sha is stale. Re-reading and retrying is
right for both and cannot clobber anything - the retry publishes against the
fresh sha. A genuinely malformed body would fail again and give up after
three tries, carrying Gitea's own words.

The log now prints which code it was, rather than assuming.
This commit is contained in:
r-zakarya
2026-08-21 16:56:48 +01:00
parent 31bf4f920c
commit 30b2413ea3
3 changed files with 34 additions and 8 deletions
+2 -1
View File
@@ -832,7 +832,8 @@ begin
if LPut.Status = ssConflict then
begin
Log('save: 409 - another device published, re-reading');
Log(Format('save: %d - another device published, re-reading',
[LPut.HttpCode]));
LPlain := '';
Continue;
end;