mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 22:50:53 +00:00
Only use Content-Disposition's filename as prefix when it exists.
This commit is contained in:
parent
b6eb81cbef
commit
8bacbfb691
@ -199,7 +199,7 @@ module {{moduleName}}
|
||||
# @return [Tempfile] the file downloaded
|
||||
def download_file(response)
|
||||
content_disposition = response.headers['Content-Disposition']
|
||||
if content_disposition
|
||||
if content_disposition and content_disposition =~ /filename=/i
|
||||
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
||||
prefix = sanitize_filename(filename)
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user