Skip to content

Commit 5cf8285

Browse files
committed
Python: Fix default mimetype for django FileResponse
1 parent 826aede commit 5cf8285

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python/ql/src/semmle/python/frameworks/Django.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,10 @@ private module Django {
14381438
// How to support the `headers` argument here?
14391439
override DataFlow::Node getMimetypeOrContentTypeArg() { none() }
14401440

1441-
override string getMimetypeDefault() { result = "text/html" }
1441+
override string getMimetypeDefault() {
1442+
// see https://github.com/django/django/blob/ebb08d19424c314c75908bc6048ff57c2f872269/django/http/response.py#L471-L479
1443+
result = "application/octet-stream"
1444+
}
14421445
}
14431446

14441447
/** Gets a reference to an instance of `django.http.response.FileResponse`. */

0 commit comments

Comments
 (0)