Skip to content

Commit

Permalink
Open /logs in binary mode
Browse files Browse the repository at this point in the history
This endpoint sends binary data -- at least the 8 byte header (which the
code strips off), but also the console logs could very well have ASCII
control characters and such. The Python bridge decodes text channels a
little differently than the C bridge; this fixes container logs with
current Python bridge.
  • Loading branch information
martinpitt committed Feb 2, 2023
1 parent 8a7a0f1 commit bad39a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ContainerLogs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class ContainerLogs extends React.Component {
method: "GET",
path: client.VERSION + "libpod/containers/" + this.props.containerId + "/logs",
body: "",
binary: true,
params: {
follow: true,
stdout: true,
Expand Down Expand Up @@ -140,7 +141,7 @@ class ContainerLogs extends React.Component {
}
// First 8 bytes encode information about stream and frame
// See 'Stream format' on https://docs.docker.com/engine/api/v1.40/#operation/ContainerAttach
this.view.writeln(data.substring(8));
this.view.writeln(data.slice(8));
}
}

Expand Down

0 comments on commit bad39a9

Please sign in to comment.