diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache index 71a39208238..496d52d3757 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/api_client.mustache @@ -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