From f18ec189b8d6c5b3431d462218b07d67d7fdb603 Mon Sep 17 00:00:00 2001 From: Safihre Date: Tue, 1 Nov 2016 08:52:41 +0100 Subject: [PATCH] Only shorten pathname on Windows for par2 Otherwise unicode paths are misformed and not detected. This is also how we do it for unrar. --- sabnzbd/newsunpack.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sabnzbd/newsunpack.py b/sabnzbd/newsunpack.py index 64155c9..e9e5c7c 100644 --- a/sabnzbd/newsunpack.py +++ b/sabnzbd/newsunpack.py @@ -1063,16 +1063,17 @@ def par2_repair(parfile_nzf, nzo, workdir, setname, single): assert isinstance(nzo, sabnzbd.nzbstuff.NzbObject) # Check if file exists, otherwise see if another is done - parfile = os.path.join(workdir, parfile_nzf.filename) - if not os.path.exists(parfile) and parfile_nzf.extrapars: + parfile_path = os.path.join(workdir, parfile_nzf.filename) + if not os.path.exists(parfile_path) and parfile_nzf.extrapars: for new_par in parfile_nzf.extrapars: test_parfile = os.path.join(workdir, new_par.filename) if os.path.exists(test_parfile): - parfile = test_parfile + parfile_nzf = new_par break - parfile = short_path(parfile) + # Shorten just the workdir on Windows workdir = short_path(workdir) + parfile = os.path.join(workdir, parfile_nzf.filename) old_dir_content = os.listdir(workdir) used_joinables = ()