1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-07-08 19:49:09 +00:00

[PR #12063/3558e3c7 backport][stable-12] Fix flatpak id check (#12073)

Fix flatpak id check (#12063)

* Fix flatpak id check

This PR fixes the flatpak ID check by allowing the last component of the ID to contain dashes. The regular expression will match the flatpak ID according to the flatpak specification. It matches all 4600+ IDs currently present in flathub.

Fixes #12062

* Add changelog fragment

* Update plugins/modules/flatpak.py



* Update changelog fragment.

---------


(cherry picked from commit 3558e3c74a)

Co-authored-by: Gerben Welter <gerben@welter.nu>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2026-05-17 11:49:48 +02:00 committed by GitHub
parent fd13c1bcde
commit 3e50838589
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 9 deletions

View file

@ -184,6 +184,7 @@ command:
sample: "/usr/bin/flatpak install --user --nontinteractive flathub org.gnome.Calculator"
"""
from re import match
from urllib.parse import urlparse
from ansible.module_utils.basic import AnsibleModule
@ -324,15 +325,7 @@ def _is_flatpak_id(part):
# https://docs.flatpak.org/en/latest/conventions.html#application-ids
# Flathub:
# https://docs.flathub.org/docs/for-app-authors/requirements#application-id
if "." not in part:
return False
sections = part.split(".")
if len(sections) < 2:
return False
domain = sections[0]
if not domain.islower():
return False
return all(section.isalnum() for section in sections[1:])
return match(r"^[a-z]{2,}(\.\w+)+\.[\w-]+$", part)
def _parse_flatpak_name(name):