Skip to content

Commit 8bacbfb

Browse files
committed
Only use Content-Disposition's filename as prefix when it exists.
1 parent b6eb81c commit 8bacbfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/swagger-codegen/src/main/resources/ruby/api_client.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ module {{moduleName}}
199199
# @return [Tempfile] the file downloaded
200200
def download_file(response)
201201
content_disposition = response.headers['Content-Disposition']
202-
if content_disposition
202+
if content_disposition and content_disposition =~ /filename=/i
203203
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
204204
prefix = sanitize_filename(filename)
205205
else

0 commit comments

Comments
 (0)