Skip to content

Filepath in tracks download doesn't sanitize "/" in elements name

The tracks-download doesn't remove the "/" in an elements name, thus potentially creating unwanted directories. Also characters get sanitized, which actually are valid for a filepath (though this second issue is less important for me).

As an example:

I have the a track with the following metadata

artist: Der wahre Heino
album:  Deutschland/Die letzte Schlacht 7" 
track: Die letzte Schlacht

On exporting it via tracks download with the default template, it exports Der wahre Heino - Deutschland/Die letzte Schlacht 7 - Die letzte Schlacht.flac - so a directory and a file. Here I'd expect it to only export one file.

My export from picard of this particular track had created the following structure: Der wahre Heino/Deutschland_Die letzte Schlacht 7"/Die letzte Schlacht.flac - replacing the /by _.

I would propose to go through the filename_params before applying template.format and replacing any / with _ in the download step. This would fix the issue with the additional directories.

The issue with the " lies in pathvalidate.sanitize_filepath which is an external lib, so I don't think it's fixable easily (also again it doesn't matter all that much to me).