mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-05 21:06:09 +00:00
[Python] Add Support for Content-Disposition Header without filename (#11055)
* [Python] Add Support for CD header w/o filename * updated documentation per PR instructions * fixed formatting and updated samples and docs * revert docs changes * regenerate python samples * updated sample python test
This commit is contained in:
@@ -16,6 +16,7 @@ import os
|
||||
import pprint
|
||||
import re
|
||||
import tempfile
|
||||
import uuid
|
||||
|
||||
from dateutil.parser import parse
|
||||
|
||||
@@ -1399,7 +1400,13 @@ def deserialize_file(response_data, configuration, content_disposition=None):
|
||||
|
||||
if content_disposition:
|
||||
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
|
||||
content_disposition).group(1)
|
||||
content_disposition,
|
||||
flags=re.I)
|
||||
if filename is not None:
|
||||
filename = filename.group(1)
|
||||
else:
|
||||
filename = "default_" + str(uuid.uuid4())
|
||||
|
||||
path = os.path.join(os.path.dirname(path), filename)
|
||||
|
||||
with open(path, "wb") as f:
|
||||
|
||||
Reference in New Issue
Block a user