Skip to content

Commit

Permalink
utils: Ignore non-Linux screenshots
Browse files Browse the repository at this point in the history
Fixes #4105
  • Loading branch information
bbhtt committed Nov 5, 2024
1 parent c2ac19a commit 6468852
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def appstream2dict(appstream_url=None) -> dict[str, dict]:
for i, screenshot in enumerate(screenshots):
attrs = {}

attrs["environment"] = screenshot.attrib.get("environment")

if component.attrib.get("type") == "desktop-application":
for caption in screenshot.findall("caption"):
if caption is not None:
Expand Down Expand Up @@ -178,6 +180,13 @@ def appstream2dict(appstream_url=None) -> dict[str, dict]:
app["screenshots"].append(attrs.copy())
component.remove(screenshots)

if app["screenshots"] and not all(
sc["environment"] in ("windows", "macos") for sc in app["screenshots"]
):
for sc in app["screenshots"][:]:
if sc["environment"] in ("windows", "macos"):
app["screenshots"].remove(sc)

releases = component.find("releases")
if releases is not None:
app["releases"] = []
Expand Down

0 comments on commit 6468852

Please sign in to comment.