You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a file download is handled within URLSessionImplementations,
the filename is retrieved via the header Content-Disposition part of the response.
The header is looked for an entry starting with filename=.
But the search is skipped too early, since the loop is exited if the first iteration does not match.
Example:
Try to download a file with a swift5 client for a spec like this:
/PublicDocument/Download:
get:
tags:
- Public Area
description: 'Document Download for Public Documents. Login not Required'
parameters:
- $ref: '#/components/parameters/queryId'
responses:
'200':
description: 'OK'
content:
application/pdf:
schema:
type: string
format: binary
When downloading from a server, the response header could have an answer like so:
There, the server says to use downloaded.pdf as filename. But the actual implementation of the swift5 client will exit after checking attachment and won't find filename= in the next section (separated by semicolon).
openapi-generator version
5.2.0
OpenAPI declaration file content or url
/PublicDocument/Download:
get:
tags:
- Public Area
description: 'Document Download for Public Documents. Login not Required'
parameters:
- $ref: '#/components/parameters/queryId'
responses:
'200':
description: 'OK'
content:
application/pdf:
schema:
type: string
format: binary
Bug Report Checklist
Description
When a file download is handled within URLSessionImplementations,
the filename is retrieved via the header Content-Disposition part of the response.
The header is looked for an entry starting with filename=.
But the search is skipped too early, since the loop is exited if the first iteration does not match.
Example:
Try to download a file with a swift5 client for a spec like this:
When downloading from a server, the response header could have an answer like so:
There, the server says to use downloaded.pdf as filename. But the actual implementation of the swift5 client will exit after checking attachment and won't find
filename=
in the next section (separated by semicolon).openapi-generator version
5.2.0
OpenAPI declaration file content or url
Generation Details
with apiSpecificationFile as listed above
with configeFile as follows
Steps to reproduce
Related issues/PRs
none
Suggest a fix
See #9989
The text was updated successfully, but these errors were encountered: