fix(wcd): create sticker assets when reused content is a reference
Build, Push and Deploy / build (push) Successful in 11s
Build, Push and Deploy / deploy (push) Successful in 9s

This commit is contained in:
2026-09-11 19:50:00 +08:00
parent 69162e3551
commit c26de1f498
2 changed files with 26 additions and 1 deletions
+25
View File
@@ -90,6 +90,31 @@ def test_stale_sha256_meta_does_not_reuse_mismatched_file(isolated_asset_store):
assert len(asset_dirs(isolated_asset_store)) == 2
def test_reference_with_same_content_creates_sticker_asset(isolated_asset_store):
content = SVG.encode()
existing_id = "asset_reference00000000000000000000000"
existing_dir = isolated_asset_store / existing_id[:2] / existing_id
existing_dir.mkdir(parents=True)
(existing_dir / "asset.svg").write_bytes(content)
(existing_dir / "meta.json").write_text(
json.dumps(
{
"asset_id": existing_id,
"name": "old",
"type": "reference",
"mime_type": "image/svg+xml",
"sha256": hashlib.sha256(content).hexdigest(),
}
)
)
imported = app._register_import_asset("new", content, "image/svg+xml")
assert imported["asset_id"] != existing_id
assert imported["type"] == "sticker"
assert len(asset_dirs(isolated_asset_store)) == 2
def test_wcd_production_uses_real_asset_ids(tmp_path, isolated_asset_store, monkeypatch):
manifest = {
"format": "wordcloud-canvas",