diff --git a/api/funkwhale_api/playlists/utils.py b/api/funkwhale_api/playlists/utils.py index 99c49cf7..60e488be 100644 --- a/api/funkwhale_api/playlists/utils.py +++ b/api/funkwhale_api/playlists/utils.py @@ -1,6 +1,7 @@ import logging import re from datetime import datetime + # /!\ The next import have xml vulnerabilities but this shouldn't have security implication in funkwhale # since there are only used to generate xspf file. from xml.etree.ElementTree import Element, SubElement @@ -48,7 +49,9 @@ def get_track_id_from_xspf(xspf_file): title = track.find(".//title").text album = track.find(".//album").text except AttributeError as e: - logger.info(f"Couldn't find the following attribute while parsing the xml file : {e!r}") + logger.info( + f"Couldn't find the following attribute while parsing the xml file : {e!r}" + ) continue # Finding track id in the db try: @@ -83,9 +86,11 @@ def generate_xspf_from_playlist(playlist_id): This returns a string containing playlist data in xspf format """ fw_playlist = Playlist.objects.get(id=playlist_id) - plt_tracks = fw_playlist.playlist_tracks.prefetch_related('track') + plt_tracks = fw_playlist.playlist_tracks.prefetch_related("track") xspf_playlist = Element("playlist") - xspf_tracklist = write_xspf_headers(xspf_playlist, fw_playlist.name, str(fw_playlist.creation_date)) + xspf_tracklist = write_xspf_headers( + xspf_playlist, fw_playlist.name, str(fw_playlist.creation_date) + ) for plt_track in plt_tracks: track = plt_track.track