Skip to content

Commit e558892

Browse files
committed
fix disappearing images issues
1 parent 33d820e commit e558892

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed
42.4 KB
Loading
189 KB
Loading
49.1 KB
Loading

src/powerbpy/background_image.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,16 @@ def __init__(self,
8989
# add the image as an item to the registered resources items list
9090
for pack in report_json["resourcePackages"]:
9191
if pack["name"] == "RegisteredResources":
92-
pack["items"].append(
93-
{
94-
"name": img_name,
95-
"path": img_name,
96-
"type": "Image"
97-
}
98-
)
92+
existing_paths = {item.get("path") for item in pack.get("items", [])}
93+
94+
if img_name not in existing_paths:
95+
pack["items"].append(
96+
{
97+
"name": img_name,
98+
"path": img_name,
99+
"type": "Image"
100+
}
101+
)
99102

100103
# write to file
101104
with open(self.dashboard.report_json_path,'w', encoding="utf-8") as file:

0 commit comments

Comments
 (0)