Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,9 @@ class ApiClient:
content_disposition
)
assert m is not None, "Unexpected 'content-disposition' header value"
filename = m.group(1)
filename = os.path.basename(m.group(1)) # Strip any directory traversal
if filename in ("", ".", ".."): # fall back to tmp filename
filename = os.path.basename(path)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,9 @@ def __deserialize_file(self, response):
content_disposition
)
assert m is not None, "Unexpected 'content-disposition' header value"
filename = m.group(1)
filename = os.path.basename(m.group(1)) # Strip any directory traversal
if filename in ("", ".", ".."): # fall back to tmp filename
filename = os.path.basename(path)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
Expand Down
4 changes: 3 additions & 1 deletion samples/client/echo_api/python/openapi_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,9 @@ def __deserialize_file(self, response):
content_disposition
)
assert m is not None, "Unexpected 'content-disposition' header value"
filename = m.group(1)
filename = os.path.basename(m.group(1)) # Strip any directory traversal
if filename in ("", ".", ".."): # fall back to tmp filename
filename = os.path.basename(path)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,9 @@ def __deserialize_file(self, response):
content_disposition
)
assert m is not None, "Unexpected 'content-disposition' header value"
filename = m.group(1)
filename = os.path.basename(m.group(1)) # Strip any directory traversal
if filename in ("", ".", ".."): # fall back to tmp filename
filename = os.path.basename(path)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,9 @@ def __deserialize_file(self, response):
content_disposition
)
assert m is not None, "Unexpected 'content-disposition' header value"
filename = m.group(1)
filename = os.path.basename(m.group(1)) # Strip any directory traversal
if filename in ("", ".", ".."): # fall back to tmp filename
filename = os.path.basename(path)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,9 @@ def __deserialize_file(self, response):
content_disposition
)
assert m is not None, "Unexpected 'content-disposition' header value"
filename = m.group(1)
filename = os.path.basename(m.group(1)) # Strip any directory traversal
if filename in ("", ".", ".."): # fall back to tmp filename
filename = os.path.basename(path)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,9 @@ def __deserialize_file(self, response):
content_disposition
)
assert m is not None, "Unexpected 'content-disposition' header value"
filename = m.group(1)
filename = os.path.basename(m.group(1)) # Strip any directory traversal
if filename in ("", ".", ".."): # fall back to tmp filename
filename = os.path.basename(path)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
Expand Down
Loading