From f92016c6c99ba2bccdb64f8170d2744f3a74fcf3 Mon Sep 17 00:00:00 2001 From: Bob Swift Date: Thu, 7 Apr 2022 10:06:40 -0600 Subject: [PATCH] Remove unicode zero-width space characters from file path --- picard/util/filenaming.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/picard/util/filenaming.py b/picard/util/filenaming.py index b149b7eb1..2c2472725 100644 --- a/picard/util/filenaming.py +++ b/picard/util/filenaming.py @@ -494,6 +494,7 @@ def make_save_path(path, win_compat=False, mac_compat=False): - Leading dots in file and directory names will be removed. These files cannot be properly handled by Windows Explorer and on Unix like systems they count as hidden - If mac_compat is True, normalize precomposed Unicode characters on macOS + - Remove unicode zero-width space (\\u200B) from path Args: path: filename or path to clean @@ -513,6 +514,8 @@ def make_save_path(path, win_compat=False, mac_compat=False): # Fix for precomposed characters on macOS. if mac_compat: path = unicodedata.normalize("NFD", path) + # Remove unicode zero-width space (\u200B) from path + path = path.replace("\u200B", "") return path