Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: that a context manager cant be used with FileResponse. #1645

Merged

Conversation

Bidaya0
Copy link
Collaborator

@Bidaya0 Bidaya0 commented Jul 21, 2023

No description provided.

@Bidaya0 Bidaya0 merged commit a97537f into HXSecurity:develop Jul 21, 2023
with open(temp_filename, "rb") as f:
response = FileResponse(f)
response["content_type"] = "application/octet-stream"
response = FileResponse(open(temp_filename, "rb")) # noqa: SIM115

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression

This path depends on a [user-provided value](1).
return response
# The file will be closed automatically, so don't open it with a context manager.
# https://docs.djangoproject.com/en/3.2/ref/request-response/#fileresponse-objects
response = FileResponse(open(local_file_name, "rb")) # noqa: SIM115

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression

This path depends on a [user-provided value](1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant