File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 11import os .path
22
33from django .conf import settings
4- from django .utils .encoding import force_text , force_bytes
4+ from django .utils .encoding import smart_text , smart_bytes
55
66try :
77 from urllib .parse import quote
@@ -19,6 +19,6 @@ def _convert_file_to_url(filename):
1919 url .insert (1 , head )
2020
2121 # Python3 urllib.parse.quote accepts both unicode and bytes, while Python2 urllib.quote only accepts bytes.
22- # So force bytes for quoting and then go back to unicode.
23- url = [force_bytes (url_component ) for url_component in url ]
24- return force_text (quote (b'/' .join (url )))
22+ # So use bytes for quoting and then go back to unicode.
23+ url = [smart_bytes (url_component ) for url_component in url ]
24+ return smart_text (quote (b'/' .join (url )))
You can’t perform that action at this time.
0 commit comments