$ flatpak run org.gnome.Boxes Ignoring /app/share/osinfo/.ref with missing '.xml' extension (org.gnome.Boxes:2): GLib-CRITICAL **: 00:12:43.775: g_variant_new_string ...
The SUBSTRING_INDEX function is specific to MySQL. This moves the logic to Python where we can easily get the relevant parts of the path and remove all duplicates without adding database-specific code ...