Explorar o código

HUE-1851 - Detection of compressed binary file types in Python 3 runtime needs to treat data as bytes

Rick Bernotas %!s(int64=4) %!d(string=hai) anos
pai
achega
d9993df5fa
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      apps/filebrowser/src/filebrowser/views.py

+ 3 - 3
apps/filebrowser/src/filebrowser/views.py

@@ -936,18 +936,18 @@ def _read_simple(fhandle, path, offset, length, stats):
 
 def detect_gzip(contents):
   '''This is a silly small function which checks to see if the file is Gzip'''
-  return contents[:2] == '\x1f\x8b'
+  return contents[:2] == b'\x1f\x8b'
 
 
 def detect_bz2(contents):
   '''This is a silly small function which checks to see if the file is Bz2'''
-  return contents[:3] == 'BZh'
+  return contents[:3] == b'BZh'
 
 
 def detect_avro(contents):
   '''This is a silly small function which checks to see if the file is Avro'''
   # Check if the first three bytes are 'O', 'b' and 'j'
-  return contents[:3] == '\x4F\x62\x6A'
+  return contents[:3] == b'\x4F\x62\x6A'
 
 
 def detect_snappy(contents):