Fix delete_image: use sha256 image ID instead of name+tag
DSM SYNO.Docker.Image/delete returns error 114 when called with name+tag.
The API expects the sha256 hash from the image list (field "id") as the
"id" parameter.
- Look up the sha256 hash from SYNO.Docker.Image/list (already fetched
for the in-use check), then pass params={"id": img_hash}
- Guard against missing hash with a clear error message
- Updated tests to assert id param is sent, name/tag are absent
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -225,6 +225,13 @@ async def test_delete_image_confirmed():
|
||||
assert "redis:7" in result
|
||||
assert "freed" in result
|
||||
|
||||
# Delete must use the sha256 id, not name+tag
|
||||
delete_call = next(c for c in client.request.call_args_list if c.args[1] == "delete")
|
||||
params = delete_call.kwargs.get("params") or {}
|
||||
assert params.get("id") == "sha256:cccc"
|
||||
assert "name" not in params
|
||||
assert "tag" not in params
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_image_not_found():
|
||||
@@ -330,11 +337,12 @@ async def test_delete_image_registry_prefixed_name():
|
||||
assert "Deleted" in result
|
||||
assert "open-webui" in result
|
||||
|
||||
# Verify delete was called with correct split params (not "ghcr" as name)
|
||||
# Verify delete was called with the sha256 ID, not name+tag
|
||||
delete_call = next(c for c in client.request.call_args_list if c.args[1] == "delete")
|
||||
params = delete_call.kwargs.get("params") or {}
|
||||
assert params.get("name") == "ghcr.io/open-webui/open-webui"
|
||||
assert params.get("tag") == "v0.8.10"
|
||||
assert params.get("id") == "sha256:dddd"
|
||||
assert "name" not in params
|
||||
assert "tag" not in params
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user