mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
This `mimetype` parameter was introduced inc4fa29aand its last usage removed in5bab2a3. This parameter was undocumented in the OpenAPI endpoint documentation for `/user_uploads`, therefore there shouldn't be client implementations that rely on it's presence. Removes the `request.GET` call for the `mimetype` parameter and replaces it by getting the `content_type` value from the file, which is an instance of Django's `UploadedFile` class and stores that file metadata as a property. If that returns `None` or an empty string, then we try to guess the `content_type` from the filename, which is the same as the previous behaviour when `mimetype` was `None` (which we assume has been true since it's usage was removed; see above). If unable to guess the `content_type` from the filename, we now fallback to "application/octet-stream", instead of an empty string or `None` value. Also, removes the specific test written for having `mimetype` as a url parameter in the request, and replaces it with a test that covers when we try to guess `content_type` from the filename.
42 KiB
42 KiB