Skip to content

Commit

Permalink
fix: fallabck value for HTTP_USER_AGENT should be a string
Browse files Browse the repository at this point in the history
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:`
  • Loading branch information
herrboyer authored and vdboor committed Nov 4, 2019
1 parent 3fb3014 commit 255c1d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion private_storage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 255c1d1

Please sign in to comment.