From d650ab1e106d98b5d8c92add711737d554163e2c Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 15 Jun 2023 16:04:02 -0400 Subject: [PATCH 1/2] Assume that browser can play any "video/" content type. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit x-matroska is not the only one which browsers should be able to play. E.g. video/mp4, video/webm, and video/ogg are the other ones I (and chat gpt) knows to generally be supported. To avoid needing to list them all explicitly and thus always playing catch up game of assumptions, I would just allow browser to try on any video/ one. Worse could happen it would not work, and might ask to download I guess. Might close #1626 but I didn't check if it would work for those files: ❯ curl --silent https://api.dandiarchive.org/api/assets/942b0806-2c8b-4289-a072-9e965884fcb6/ | jq .encodingFormat "video/x-msvideo" --- dandiapi/api/views/asset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dandiapi/api/views/asset.py b/dandiapi/api/views/asset.py index 669ca7f36..da0cdd9f1 100644 --- a/dandiapi/api/views/asset.py +++ b/dandiapi/api/views/asset.py @@ -156,7 +156,7 @@ def download(self, request, *args, **kwargs): content_type, ) - if content_type == 'video/x-matroska': + if content_type.startswith('video/'): return HttpResponse( f"""