MCPcopy
hub / github.com/django/django / target_filename

Method target_filename

django/utils/archive.py:145–154  ·  view source on GitHub ↗
(self, to_path, name)

Source from the content-addressed store, hash-verified

143 return True
144
145 def target_filename(self, to_path, name):
146 target_path = os.path.abspath(to_path)
147 filename = os.path.abspath(os.path.join(target_path, name))
148 try:
149 if os.path.commonpath([target_path, filename]) != target_path:
150 raise SuspiciousOperation("Archive contains invalid path: '%s'" % name)
151 except ValueError:
152 # Different drives on Windows raises ValueError.
153 raise SuspiciousOperation("Archive contains invalid path: '%s'" % name)
154 return filename
155
156 def extract(self):
157 raise NotImplementedError(

Callers 2

extractMethod · 0.80
extractMethod · 0.80

Calls 2

SuspiciousOperationClass · 0.90
joinMethod · 0.45

Tested by

no test coverage detected