Skip to content

Commit

Permalink
Fix issues in 4.12 and 4.13, with mkdtemp no longer returning relativ…
Browse files Browse the repository at this point in the history
…e path
  • Loading branch information
ChrisJefferson committed Oct 20, 2024
1 parent 1b05b2e commit 7d232ef
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dtrx/dtrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7d232ef

Please sign in to comment.