mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix file type detection for Python 2.6. Fixes #1330
To find out the type of file selected using FileManager in query tool, we use bitwise OR( | ) on two sets which is not working on python-2.6.9 version. Now we took list of elements instead of sets to fix the issue.
This commit is contained in:
committed by
Dave Page
parent
8b770ae479
commit
677008af10
@@ -1129,9 +1129,8 @@ def load_file():
|
|||||||
|
|
||||||
# check if file type is text or binary
|
# check if file type is text or binary
|
||||||
textchars = bytearray(
|
textchars = bytearray(
|
||||||
{7, 8, 9, 10, 12, 13, 27} | set(
|
[7, 8, 9, 10, 12, 13, 27]) + bytearray(
|
||||||
range(0x20, 0x100)
|
range(0x20, 0x7f)) + bytearray(range(0x80, 0x100))
|
||||||
) - {0x7f})
|
|
||||||
|
|
||||||
is_binary_string = lambda bytes: bool(
|
is_binary_string = lambda bytes: bool(
|
||||||
bytes.translate(None, textchars)
|
bytes.translate(None, textchars)
|
||||||
|
|||||||
Reference in New Issue
Block a user