From 255c1d11934936844a4aa4ef13603242c51e14d0 Mon Sep 17 00:00:00 2001 From: rboyer-anybox <52666720+rboyer-anybox@users.noreply.github.com> Date: Wed, 30 Oct 2019 10:46:17 +0100 Subject: [PATCH] fix: fallabck value for HTTP_USER_AGENT should be a string if `request.META["HTTP_USER_AGENT"]` is not set the fallback value should an empty string instead of None or else we get a `TypeError: argument of type 'NoneType' is not iterable` on `if 'WebKit' in user_agent:` --- private_storage/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/private_storage/views.py b/private_storage/views.py index f5f64fd..81c161e 100644 --- a/private_storage/views.py +++ b/private_storage/views.py @@ -126,7 +126,7 @@ def _encode_filename_header(self, filename): The filename, encoded to use in a ``Content-Disposition`` header. """ # Based on https://www.djangosnippets.org/snippets/1710/ - user_agent = self.request.META.get('HTTP_USER_AGENT', None) + user_agent = self.request.META.get('HTTP_USER_AGENT', '') if 'WebKit' in user_agent: # Support available for UTF-8 encoded strings. # This also matches Edgee.