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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
slapos.toolbox
Commits
93668a6c
Commit
93668a6c
authored
Feb 14, 2017
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: escape logs before returning it
parent
038adf58
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
slapos/runner/views.py
slapos/runner/views.py
+4
-4
No files found.
slapos/runner/views.py
View file @
93668a6c
...
@@ -18,6 +18,7 @@ import slapos
...
@@ -18,6 +18,7 @@ import slapos
from
slapos.runner.utils
import
(
checkSoftwareFolder
,
configNewSR
,
checkUserCredential
,
from
slapos.runner.utils
import
(
checkSoftwareFolder
,
configNewSR
,
checkUserCredential
,
createNewUser
,
getBuildAndRunParams
,
createNewUser
,
getBuildAndRunParams
,
getProfilePath
,
getSlapgridResult
,
getProfilePath
,
getSlapgridResult
,
html_escape
,
listFolder
,
getBuildAndRunParams
,
listFolder
,
getBuildAndRunParams
,
getProjectTitle
,
getRcode
,
updateUserCredential
,
getProjectTitle
,
getRcode
,
updateUserCredential
,
getSlapStatus
,
getSvcStatus
,
getSlapStatus
,
getSvcStatus
,
...
@@ -244,14 +245,13 @@ def getFileLog():
...
@@ -244,14 +245,13 @@ def getFileLog():
if
not
os
.
path
.
exists
(
file_path
):
if
not
os
.
path
.
exists
(
file_path
):
raise
IOError
raise
IOError
if
not
isText
(
file_path
):
if
not
isText
(
file_path
):
return
jsonify
(
code
=
0
,
content
=
"Can not open binary file, please select a text file!"
result
=
"Can not open binary file, please select a text file!"
)
if
'truncate'
in
request
.
form
:
if
'truncate'
in
request
.
form
:
content
=
tail
(
open
(
file_path
),
int
(
request
.
form
[
'truncate'
]))
content
=
tail
(
open
(
file_path
),
int
(
request
.
form
[
'truncate'
]))
return
jsonify
(
code
=
1
,
result
=
content
)
else
:
else
:
with
open
(
file_path
)
as
f
:
with
open
(
file_path
)
as
f
:
return
jsonify
(
code
=
1
,
result
=
f
.
read
())
content
=
f
.
read
()
return
jsonify
(
code
=
1
,
result
=
html_escape
(
content
))
except
:
except
:
return
jsonify
(
code
=
0
,
result
=
"Warning: Log file doesn't exist yet or empty log!!"
)
return
jsonify
(
code
=
0
,
result
=
"Warning: Log file doesn't exist yet or empty log!!"
)
...
...
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