fix(patreon): a missing media file_name is a URL-basename fallback, not API drift
CI / lint (push) Successful in 2s
CI / frontend-build (push) Successful in 24s
CI / backend-lint-and-test (push) Successful in 25s
CI / integration (push) Successful in 3m0s

The native client treated a gallery image without `file_name` as schema drift
and raised "Patreon API changed — ingester needs update", failing the whole walk
(operator-flagged 2026-06-07: BlenderKnight post 73665615, kind=images). But the
resource had a valid URL, and the code already derives a filename from the URL
basename right below the raise — the same fallback gallery-dl uses. Patreon
legitimately serves some images without file_name, so this isn't drift.

Drop the require_file_name gate from _media_item: file_name is now optional for
every kind (images/attachments/postfile), falling back to the URL basename.
Genuine drift still raises — no resolvable URL, or a media id referenced by a
relationship but absent from `included`. Test updated to assert the fallback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 23:10:46 -04:00
parent 14c4dd1ea0
commit 4c42a15fa1
2 changed files with 15 additions and 18 deletions
+8 -5
View File
@@ -159,9 +159,10 @@ def test_non_list_data_raises_drift(client):
client._validate_response({"data": {"id": "1"}})
def test_media_missing_file_name_raises_drift(client):
# A media resource referenced by a gallery relationship but lacking
# file_name is drift from the contract.
def test_media_missing_file_name_falls_back_to_url_basename(client):
# A gallery image with a valid URL but no file_name is NOT drift — Patreon
# serves these (operator-flagged 2026-06-07, BlenderKnight post 73665615);
# fall back to the URL basename like gallery-dl does.
post = {
"id": "2000",
"type": "post",
@@ -175,8 +176,10 @@ def test_media_missing_file_name_raises_drift(client):
+ "/x.jpg"
}
}
with pytest.raises(PatreonDriftError):
client.extract_media(post, index)
items = client.extract_media(post, index)
assert len(items) == 1
assert items[0].filename == "x.jpg"
assert items[0].kind == "images"
def test_media_referenced_but_absent_raises_drift(client):