From 7d232ef70848eae1a1aeafcc3da499776a10c2a2 Mon Sep 17 00:00:00 2001 From: Chris Jefferson Date: Sun, 20 Oct 2024 14:22:05 +0800 Subject: [PATCH] Fix issues in 4.12 and 4.13, with mkdtemp no longer returning relative path --- dtrx/dtrx.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dtrx/dtrx.py b/dtrx/dtrx.py index ab8a836..9bfdeb7 100755 --- a/dtrx/dtrx.py +++ b/dtrx/dtrx.py @@ -157,8 +157,10 @@ class DirectoryChecker(FilenameChecker): free_close = None def create(self): - return tempfile.mkdtemp(prefix=self.original_name + ".", dir=".") - + dirname = tempfile.mkdtemp(prefix=self.original_name + ".", dir=".") + # We want to directory to be relative to current directory + dirname = os.path.join(".",os.path.relpath(dirname)) + return dirname class NonblockingRead(object): iostream = None @@ -421,7 +423,11 @@ def extract(self, ignore_passwd=False, password=None): self.ignore_pw = ignore_passwd self.password = password try: - self.target = tempfile.mkdtemp(prefix=".dtrx-", dir=".") + dirname = tempfile.mkdtemp(prefix=".dtrx-", dir=".") + # We want to directory to be relative to current directory + dirname = os.path.join(".",os.path.relpath(dirname)) + self.target = dirname + except (OSError, IOError) as error: raise ExtractorError("cannot extract here: %s" % (error.strerror,)) old_path = os.path.realpath(os.curdir)