OpenAPITools / OpenAPITools/openapi-generator
Wrong Content-Type for gzip files [BUG][PYTHON]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
When uploading a gzip file the Content-Type is set to application/octet-stream. According to RFC6713 it should be application/gzip.
openapi-generator version
v4.3.1 but bug still exists in master
Suggest a fix
Possible fix inspired by this. Targeting this line.
filename = os.path.basename(f.name)
filedata = f.read()
mimetype = (mimetypes.guess_type(filename)[0] or
'application/octet-stream')
# This is added
if mimetypes.guess_type(filename)[1] == "gzip":
mimetype = "application/gzip"
# End of change
If accepted I can make a pull request.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at modules/openapi-generator/src/main/resources/python/api_client.mustache around line 530, where uploaded files receive their Content-Type. Review the existing mimetypes handling and verify that a generated Python client uses application/gzip for gzip files instead of application/octet-stream.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100