deflacue icon indicating copy to clipboard operation
deflacue copied to clipboard

Illegal characters in target paths result in crash

Open perepichka opened this issue 3 years ago • 1 comments

Deflacue will fail to split FLAC files when Album/Band names contain illegal characters on Windows.

In my case, the album name is titled: What I Have to Hide...

The code in the process_cue method creates an additional folder structure on top of the target path using the artist name, album name, and date. In my case, it attempts to create the following: [base_directory]\\Night of Suicide\\2006 - What I Have to Hide.... However, _create_target_path method used to create this folder uses os.makedirs, which has the brilliant behavior of silently pruning the three dots at the end, creating [base_directory]\\Night of Suicide\\2006 - What I Have to Hide instead. Subsequently, the reference to the target path is now incorrect and SoX will fail as it attempts to write to the directory with the 3 dots, which does not exist.

There exists a sanitize function in process_cue, which can be extended to remove illegal characters. Additionally/alternatively, it would be nice to have an optional flag to disable the entire prepending system and simply have deflacue output to the exact directory the user passes.

I can make a PR for either or both, let me know.

perepichka avatar Apr 22 '21 16:04 perepichka

os.makedirs, which has the brilliant behavior of silently pruning the three dots at the end

That comes from the OS layer. See https://bugs.python.org/issue22744#msg230101 - so a workaround might be to sanitize those on Windows. Pull request is welcome.

idlesign avatar Apr 23 '21 01:04 idlesign