Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.toolbox
Commits
e4b53bd9
Commit
e4b53bd9
authored
Jul 21, 2019
by
Bryton Lacquement
🚪
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
f5e23695
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
slapos/runner/utils.py
slapos/runner/utils.py
+3
-1
No files found.
slapos/runner/utils.py
View file @
e4b53bd9
...
@@ -28,6 +28,7 @@ from slapos.runner.process import Popen
...
@@ -28,6 +28,7 @@ from slapos.runner.process import Popen
from
passlib.apache
import
HtpasswdFile
from
passlib.apache
import
HtpasswdFile
import
slapos.slap
import
slapos.slap
from
slapos.grid.utils
import
md5digest
from
slapos.grid.utils
import
md5digest
from
slapos.util
import
str2bytes
logger
=
logging
.
getLogger
(
'slaprunner'
)
logger
=
logging
.
getLogger
(
'slaprunner'
)
...
@@ -764,7 +765,8 @@ def isText(file):
...
@@ -764,7 +765,8 @@ def isText(file):
"""Return True if the mimetype of file is Text"""
"""Return True if the mimetype of file is Text"""
if not os.path.exists(file):
if not os.path.exists(file):
return False
return False
text_range = ''.join(map(chr, [7, 8, 9, 10, 12, 13, 27] + range(0x20, 0x100)))
text_range = str2bytes(''.join(map(chr, [7, 8, 9, 10, 12, 13, 27]
+ list(range(0x20, 0x100)))))
is_binary_string = lambda bytes: bool(bytes.translate(None, text_range))
is_binary_string = lambda bytes: bool(bytes.translate(None, text_range))
try:
try:
return not is_binary_string(open(file).read(1024))
return not is_binary_string(open(file).read(1024))
...
...
Bryton Lacquement
🚪
@bminusl
mentioned in commit
1c8269b2
·
Jul 21, 2019
mentioned in commit
1c8269b2
mentioned in commit 1c8269b2b12414846dab010abbc289a99f1faf1d
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment